I deployed a web app into weblogic, but unable to reach the datasource.
The web application has a web.xml and has the following resource configuration
<!-- Reference for the store datasource -->
The weblogic is configured with the following Data Source.
Name : STPDataSource
JNDI Name : jdbc/STPStoreDataSource
Targets : myserver, Server-0
The JNDI tree has the following entry
JNDI Tree Structure
And the jndi entry for jdbc/STPStoreDataSource is
Binding Name: jdbc.STPStoreDataSource
The error I recieve in the server-0.out is
com.anitesolutions.utils.servlet.config.ConfigDatabaseException: Configuration Error: Datasource undefined - 'STPDataSource'
The same code works in websphere, but not in weblogic. I tested the Datasource in weblogic if it connects to the DB and it does. The problem is the container is unable to reach the DataSource. I can't figure out what is wrong.
Your suggestion will be useful.
I have got a hint. I am migrating an application in Websphere to Weblogic. In Websphere, ibm-web-bnd.xml file handles the binding between the project resource name and the datasource in websphere. The id="STPResourceRef_1" mentioned above is resolved to jdbc/STPStoreDataSource in ibm-web-bnd.xml . The code continues to use ctx.lookup("STPDataSource"). Is there any such binding in Java EE 6 or weblogic specific files? If you can tell me this missing link, my problem will be solved.
I have found the missing link and want to share with people who would have a similar problem.
In Websphere, there is a binding file ibm-web-bnd.xmi that binds the jndi value and the resource-ref. In Java EE 6, this is done by a <lookup> sub-element in the resource-ref. I am not sure if there is a similar way in J2EE 1.5. I am hoping that this change will help me deploy in Websphere and Weblogic, as I am using a Java EE standard.