Jan 5, 2009

Write EJB Client

The JNDI could support java client  to get EJB instance from J2EE Container.
We have two type configuration for JNDI. First one,To hardcode properties in program look like listing 1, another one is put properties in file jndi.properties and place on root directory of classes.
Listing 1
Properties props = new Properties();        
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "localhost:1099");
InitialContext ctx = new InitialContext(props);
helloworld = (HelloWorld)ctx.lookup("HelloWorldBean/remote");


Listing 2 (jndi.properties)


java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=localhost:1099


Ps. if application depoly on EJB container the container will import jndi properties form default configuration.

3 comments:

Muhammad Zohaib said...

Thanks For Shatring,Really a Nice Post.
UltraEdit Crack

KANJU KING said...

https://downloadpc.co/ashampoo-photo-recovery-crack/

KANJU KING said...

I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
Very interesting blog.
Panda Antivirus Pro Crack
Lansweeper Crack
UltraEdit Crack
EaseUS Data Recovery Wizard Crack
Glary Utilities Pro Crack
Ashampoo Photo Recovery Crack
Recover My Files Crack
CyberGhost VPN Crack