2
votes

Wen accessing JNDI data source in applications the name has to be provided. But there is a difference between how they are provided in Tomcat vs Weblogic.

When I specify the name as "jdbc/source1" in the container it is fine for Weblogic, but in tomcat I have to search for "java:comp/env/jdbc/source1".

If I got an application that I sometimes deploy in a tomcat and sometimes in a Weblogic changing the name to look for is very annoying.

What is the right approach to overcome this?
Is there a way to configure Tomcat to look automatically in java:comp/env/ or provide the JNDIs not there but like Weblogic?
Or is there a well known code to automatically prepend the "java:comp/env/" if deployed in tomcat.

1

1 Answers

0
votes

Although it is possible for J2EE components to use the global environment directly in Weblogic, it is preferable to use the component environment. Hence, it is standard way to add “java:comp/env/” which is supported by all J2EE application servers(supported in Weblogic as well).

For more reference please visit https://docs.oracle.com/cd/E13222_01/wls/docs81/jndi/jndi.html