aries-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bengt Rodehav <>
Subject Aries JPA, OpenJPA and MySQL
Date Sat, 18 Sep 2010 15:11:50 GMT
I cannot seem to get OpenJPA and MySQL to work in Aries. I use Aries
0.2-incubating, OpenJPA 2.0.1 and the 5.1.13 version of MySQL's JDBC driver.

I have no problems connecting to MySQL outside of OSGi but cannot get it to
work in OSGi. BTW I mostly use PaxExam for the Aries tests and I run on
Felix 2.0.0.

My persistence.xml looks as follows:

<?xml version="1.0" encoding="UTF-8"?>

<persistence xmlns="" xmlns:xsi="



  <persistence-unit name="refdataPU" transaction-type="JTA">

>  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>







      <property name="openjpa.Connection2URL"
> value="jdbc:mysql://localhost:3306/refdata" />

      <property name="openjpa.Connection2DriverName"
> value="com.mysql.jdbc.Driver" />

      <property name="openjpa.Connection2UserName" value="someuser" />

      <property name="openjpa.Connection2Password" value="somepassword" />

      <property name="openjpa.ConnectionFactoryMode" value="managed" />

      <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)" />

      <property name="openjpa.jdbc.DBDictionary"
> value="org.apache.openjpa.jdbc.sql.MySQLDictionary" />

      <property name="openjpa.jdbc.UpdateManager" value="operation-order" />

      <property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=INFO" />




and the blueprint for my datasource looks as follows:

<?xml version="1.0" encoding="UTF-8"?>

<blueprint xmlns="" xmlns:xsi="

> default-activation="lazy">

>   <bean id="refdataXADataSource"
> class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">

      <property name="user" value="someuser" />

      <property name="password" value="somepassword" />

      <property name="URL" value="jdbc:mysql://localhost:3306/refdata" />

<!--      <property name="driverClassName" value="com.mysql.jdbc.Driver"
> />-->

<!--      <property name="url" value="jdbc:mysql://localhost:3306/refdata"
> />-->


>   <service ref="refdataXADataSource" interface="javax.sql.XADataSource">


      <entry key="" value="jdbc/refdatajta" />




I get the following exception:

<openjpa-2.0.1-r422266:989424 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: There were errors
> initializing your configuration: <openjpa-2.0.1-r422266:989424 fatal user
> error> org.apache.openjpa.util.UserException: A connection could not be
> obtained for driver class "null" and URL "null".  You may have specified an
> invalid URL.

> org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(

> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(

> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(

I've tried numerous ways to configure the MysqlXADataSource to no avail.
Seems like this must be a very common combination which leads me to hope
that someone can help me out. The only samples I've seen in combination with
Aries uses a Derby database that doesn't seem to need any configuration.

I don't think there is anything wrong with the actual settings (user,
password, URL) since they work perfectly outside of OSGi. However, the
settings don't seem to get to the data source. I've probably not fully
understood how this works. My next step would be to somehow configure a
connection pool but it seems like just getting things to work occupies most
of time right now.

Any clues?


View raw message