The Weblogic servers we are using have been configured to allow JNDI datasource names like \"appds\".
For development (localhost), we might be running Tomcat and whe
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:
entry in web.xml for your app to use a single nameWEB-INF/weblogic.xml to map your jndi name to the resource managed by WebLogicMETA-INF/context.xml to map your jndi name to the resource managed by Tomcat
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)