Using JNDI properties file in OpenEJB embedded mode

824 Views Asked by At

Eventhough the jndi properties file is kept in the classpath its not loaded and JNDI properties when configured in JVM arguments in ANT its working fine.

<jvmarg value="-Djava.naming.factory.initial=org.openejb.client.LocalInitialContextFactory"/>   

How to configure the JNDI thorugh properties so that even when

Context=new InititalContext() is used in the EJB's the JNDI properties that are configured in properties needs to be loaded.

Thanks,

Velmurugan R

1

There are 1 best solutions below

0
On

Definitely make sure the jndi.properties file is at the root of the classpath and not in a META-INF/ directory or any other location. By root, I mean some directory that is parallel to a where a META-INF/ would be. For example:

  • foo.jar/jndi.properties
  • foo.jar/META-INF/MANIFEST.MF

That file is processed by the JVM itself, so if it doesn't work, odds are it is related to it not being on the classpath correctly.