I have a Java EE Application consisting many modules. I am trying to be able to make Indirect JNDI lookups.
I followed these Steps:
ejb-jar.xml: In each module. i defined an enterprise bean. All DAOs in the module inherits from this DAO(MyDataAccessObject)
<enterprise-beans>
<session>
<ejb-name>DataAccessObject</ejb-name>
<ejb-class>com.mycompany.dao.MyDataAccessObject</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref id="MyRef">
<description />
<res-ref-name>jdbc/My_db</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
</enterprise-beans>
persistence.xml : I defined in each persistence.xml (in every module)
<jta-data-source>java:comp/env/jdbc/My_db</jta-data-source>
ibm-application-bnd.xml
<resRefBindings xmi:id="MyRef" jndiName="jdbc/My_db">
?????? Should I use resRefBindings. If yes, how?
</resRefBindings>
What should i add to this document that Websphere knows about java:comp/env/jdbc/My_db?
Is it enough/correct what i have already done?
Currently I get this error if i want to start the application:
The server cannot locate the java:comp/env/jdbc/my_db data source for the My_Modul persistence unit because it has encountered the following exception:
Name comp/env/jdbc not found in context "java:".
Edit: I found also this error in an incident file:
Caused by: <openjpa-2.1.2-SNAPSHOT-r422266:1384519 fatal user error> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:76)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:844)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:602)
at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1510)
jdbc/My_dbin your jta-data-source? I admit I haven't done exactly this but am thinking that however you map it, the way you reference it will be via theres-ref-name. (We always map our references at deploy time through the WebSphere console rather than by creating the binding files.) - dbreaux