Tomcat vs Weblogic JNDI Lookup?

JndiLocatorSupport has a property resourceRef When setting this true, "java:comp/env/" prefix will be prepended automatically. So I believe it would be correct to differentiate this parameter when moving from Tomcat to Weblogic.

JndiLocatorSupport has a property resourceRef. When setting this true, "java:comp/env/" prefix will be prepended automatically. So I believe it would be correct to differentiate this parameter when moving from Tomcat to Weblogic.

How to use a single JNDI name in your web app I've struggled with this for a few months myself. The best solution is to make your application portable so you have the same JNDI name in both Tomcat and Weblogic. In order to do that, you change your web.

Xml and spring-beans. Xml to point to a single jndi name, and provide a mapping to each vendor specific jndi name. I've placed each file below.

You need: A entry in web. Xml for your app to use a single name A file WEB-INF/weblogic. Xml to map your jndi name to the resource managed by WebLogic A file META-INF/context.

Xml to map your jndi name to the resource managed by Tomcat This can be either in the Tomcat installation or in your app. As a general rule, prefer to have your jndi names in your app like jdbc/MyDataSource and jms/ConnFactory and avoid prefixing them with java:comp/env/. Also, data sources and connection factories are best managed by the container and used with JNDI.It's a common mistake to instantiate database connection pools in your application.

Spring web. Xml My data source jdbc/appds javax.sql. DataSource Container weblogic.

Xml appds jdbc/appds META-INF/context. Xml (for Tomcat).

Set developers machines with the tomcat name and production with the Weblogic name. You can even set your code to use a default one (WebLogic) in case the variable don't exist.

I've managed the trick with Tomcat and WebLogic using Spring. Here is a description of how it worked for me.

My application also had a similar problem and this is how I solved it: 1) WEB-INF/classes/application. Properties contains the entry: ds. Jndi=java:comp/env/jdbc/tcds 2) On the WLS machine, I have an entry in the /etc/sysenv file: ds.

Jndi=wlsds 3) I configured spring to lookup the JNDI vis the property ${ds. Jndi}, using a PropertyPlaceholderConfigurer bean with classpath:application. Properties and file:/etc/sysenv as locations.

I also set the ignoreResourceNotFound to true so that developers need not have /etc/sysenv on their machines. 4) I run an integration test using Cargo+Jetty and I could not properly set up a JNDI environment there. So I have a fallback BasicDataSource configured too using the defaultObject property of JndiObjectFactoryBean.

This is what we have for tomcat: context: spring: The jee namespace comes from: springframework.org/schema/jee springframework.org/schema/jee/spring-jee-2.0.xsd.

Setting up DataSource in the application itself is not that crazy :) I would say that is even mandatory if application is meant to be deployed on a grid. River, GigaSpaces, or similar. Note: I do not say connection settings have to be hardcoded inside of WAR, they need to be supplied at deployment time/runtime.

This simplifies management of cloud instances since there is only on place to configure. Configuring resources at the container makes sense only if multiple applications are deployed there and they can use shared resource. Again, in cloud type of deployments there is only one application per servlet container instance.

The following config works in Tomcat and Weblogic for me. In Spring: In Weblogic Admin Console create a JDBC resource named jdbc/AgriShare. Under 'Targets', MAKE SURE YOU TARGET THE DATASOURCE TO THE SERVER YOU ARE DEPLOYING YOUR APP TO!.

This particular point cost me some time just now...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions