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.
2 comments:
Thanks For Shatring,Really a Nice Post.
UltraEdit Crack
https://downloadpc.co/ashampoo-photo-recovery-crack/
Post a Comment