aries-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Madhavan <mattmadha...@gmail.com>
Subject Re: Aries/OpenJPA strange error - A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName?
Date Tue, 22 Nov 2011 20:06:30 GMT
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.cummins@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 <mattmadhavan@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">
>  <description>Persistence xxxxxxxxx</description>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>     *<jta-data-source>jdbc/dupcheckcts</jta-data-source>*
>  <class>com.xxxx.entity.Clx</class>
> <class>com.xxxx.entity.Clxxxxxl</class>
>  <class>com.xxxx.entity.Clxxxxxt</class>
> <class>com.xxxx.entity.Clxxxxxx</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
>
>

Mime
View raw message