RE: Aries/OpenJPA strange error - A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName?
Hi, That's the error Open JPA gives you when the DataSource fails. This is probably because your JNDI lookup is failing. Is there a valid DataSource at jdbc/dupcheckcts ? Regards, Tim Ward --- Apache Aries PMC member Enterprise OSGi advocate Enterprise OSGi in Action (http://www.manning.com/cummins) --- Date: Mon, 21 Nov 2011 15:00:43 -0600 Subject: Aries/OpenJPA strange error - A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName? From: mattmadha...@gmail.com To: user@aries.apache.org Hello,I'm using Apache Aries 0.4 (from IBM WAS) and OpenJPA 2.1.1-SNAPSHOT also from IBM. I have a data source defined in WAS: Jndi Name : jdbc/dupcheckcts I have my persistence.xml as follows: ?xml version=1.0 encoding=UTF-8?persistence version=2.0 xmlns=http://java.sun.com/xml/ns/persistence; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd; persistence-unit name=DuCk_jpa transaction-type=JTA descriptionPersistence x/description providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider jta-data-sourcejdbc/dupcheckcts/jta-data-source classcom..entity.Clx/class classcom..entity.Clxl/class classcom..entity.Clxt/class classcom..entity.Clxx/class .. propertiesproperty name=openjpa.Log value=DefaultLevel=TRACE, Runtime=TRACE, Tool=TRACE, SQL=TRACE / property name=openjpa.RuntimeUnenhancedClasses value=unsupported / property name=openjpa.Compatibility value=StrictIdentityValues=false //properties When I deploy the EBA and start the app I'm getting the following error: Caused by: openjpa-2.1.1-SNAPSHOT-r422266:1141200 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) Any ideas please? Thanks in advance! ThanksMatt
Re: Aries/OpenJPA strange error - A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName?
Hi Matt, The error message you're seeing is from OpenJPA. It produces the same error message whether there's no datasource defined or the datasource is defined but can't be looked up. However, in this case I notice you only have a jta datsource defined. It couldn't hurt to also define a non-jta-datasource. Whether it's required depends on the JPA implementation (some optimise reads), but better safe than sorry. I also notice your version numbers are pretty high. Which version of WAS are you using? Is it the Liberty profile? If it is, you'll need to add resource references for your datasource and then look it up using a java:comp/ namespace. Holly -- Want to read more? www.manning.com/cummins Enterprise OSGi in Action On 21 Nov 2011, at 21:00, Matt Madhavan mattmadha...@gmail.com wrote: Hello, I'm using Apache Aries 0.4 (from IBM WAS) and OpenJPA 2.1.1-SNAPSHOT also from IBM. I have a data source defined in WAS: Jndi Name : jdbc/dupcheckcts I have my persistence.xml as follows: ?xml version=1.0 encoding=UTF-8? persistence version=2.0 xmlns=http://java.sun.com/xml/ns/persistence xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd persistence-unit name=DuCk_jpa transaction-type=JTA descriptionPersistence x/description providerorg.apache.openjpa.persistence.PersistenceProviderImpl/ provider jta-data-sourcejdbc/dupcheckcts/jta-data-source classcom..entity.Clx/class classcom..entity.Clxl/class classcom..entity.Clxt/class classcom..entity.Clxx/class .. properties property name=openjpa.Log value=DefaultLevel=TRACE, Runtime=TRACE, Tool=TRACE, SQL=TRACE / property name=openjpa.RuntimeUnenhancedClasses value=unsupported / property name=openjpa.Compatibility value=StrictIdentityValues=false / /properties When I deploy the EBA and start the app I'm getting the following error: Caused by: openjpa-2.1.1-SNAPSHOT-r422266:1141200 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) Any ideas please? Thanks in advance! Thanks Matt
Re: Aries/OpenJPA strange error - A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName?
Hello Everyone. Thanks for the reply. I found the issue and solved it. Actually this DAO code was inherited legacy code and the developer was creating the EntityManagerFactory and EntityManager from the code as follows: *{EntityManagerFactory factory = Persistence.createEntityManagerFactory(DuCk_jpa); * *EntityManager entityManager = factory.createEntityManager();* while I had added the following code for the EntityManager to be injected! * @PersistenceContext(unitName = DuCk_jpa)* *EntityManager entityManager = null;* while the above code worked in a normal EAR env, it did not work in EBA env. I removed the hard coded (Factory etc) and it works fine now! Thanks Matt On Tue, Nov 22, 2011 at 4:19 AM, Holly Cummins holly.k.cumm...@googlemail.com wrote: Hi Matt, The error message you're seeing is from OpenJPA. It produces the same error message whether there's no datasource defined or the datasource is defined but can't be looked up. However, in this case I notice you only have a jta datsource defined. It couldn't hurt to also define a non-jta-datasource. Whether it's required depends on the JPA implementation (some optimise reads), but better safe than sorry. I also notice your version numbers are pretty high. Which version of WAS are you using? Is it the Liberty profile? If it is, you'll need to add resource references for your datasource and then look it up using a java:comp/ namespace. Holly -- Want to read more? www.manning.com/cummins Enterprise OSGi in Action On 21 Nov 2011, at 21:00, Matt Madhavan mattmadha...@gmail.com wrote: Hello, I'm using Apache Aries 0.4 (from IBM WAS) and OpenJPA 2.1.1-SNAPSHOT also from IBM. I have a data source defined in WAS: Jndi Name : *jdbc/dupcheckcts* * * I have my persistence.xml as follows: ?xml version=1.0 encoding=UTF-8? persistence version=2.0 xmlns=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd; persistence-unit name=DuCk_jpa transaction-type=JTA descriptionPersistence x/description providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider *jta-data-sourcejdbc/dupcheckcts/jta-data-source* classcom..entity.Clx/class classcom..entity.Clxl/class classcom..entity.Clxt/class classcom..entity.Clxx/class .. properties property name=openjpa.Log value=DefaultLevel=TRACE, Runtime=TRACE, Tool=TRACE, SQL=TRACE / property name=openjpa.RuntimeUnenhancedClasses value=unsupported / property name=openjpa.Compatibility value=StrictIdentityValues=false / /properties When I deploy the EBA and start the app I'm getting the following error: Caused by: openjpa-2.1.1-SNAPSHOT-r422266:1141200 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) Any ideas please? Thanks in advance! Thanks Matt