You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Charles Moulliard <cm...@gmail.com> on 2011/04/12 14:20:45 UTC
OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC Driver
or DataSource class name must be specified in the ConnectionDriverName property
Hi,
I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
when I try to insert data in the DB, openJPA generates the following
error :
Caused by: java.lang.RuntimeException: There were errors initializing
your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
The property <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
in the persistence.xml file point to the XADataSource exposed as an
osgi service
Persistence
**************
<persistence-unit name="reportincident" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
<!-- Required by openJPA to update sequence table outside of
Global Tx Management -->
<non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
<class>com.mycompany.persistence.model.Incident</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<!-- openjpa & HSQLDB -->
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(SchemaAction='add,deleteTableContents')"/>
<property name="openjpa.Log"
value="commons"/>
<property name="openjpa.jdbc.DBDictionary"
value="hsql(useSchemaName=true)"/>
<property name="openjpa.jdbc.Schema"
value="PUBLIC"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<property name="openjpa.ManagedRuntime"
value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
<property name="openjpa.Multithreaded"
value="true"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<!--<property name="openjpa.ConnectionFactoryMode"
value="managed"/>-->
</properties>
Blueprint config of the DataSource
****************************************
<service auto-export="interfaces" ref="jta">
<service-properties>
<entry key="transactional" value="true"/>
</service-properties>
</service>
<service auto-export="interfaces" ref="jta">
<service-properties>
<entry key="transactional" value="true"/>
</service-properties>
</service>
Any idea is welcome.
Regards,
Charles Moulliard
Sr. Principal Solution Architect - FuseSource
Apache Committer
Blog : http://cmoulliard.blogspot.com
Twitter : http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard
Skype: cmoulliard
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Quck question : Do you use camel-blueprint with your transacted camel route ?
On Tue, Apr 12, 2011 at 7:09 PM, Charles Moulliard <cm...@gmail.com> wrote:
> I have found the reason.
>
> The Tx Manager configured in my spring config file was for the
> following interface
> org.springframework.transaction.PlatformTransactionManager and not
> javax.transaction.Transaction
>
> <tx:annotation-driven transaction-manager="txManager"/>
>
> <osgi:reference id="txManager"
> interface="javax.transaction.TransactionManager"/>
>
> <bean id="entityManagerFactory"
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
> <property name="persistenceUnitName" value="reportincident"/>
> </bean>
>
> That works now. Rollback occurs.
>
> Cheers
>
> Charles
>
> On Tue, Apr 12, 2011 at 7:01 PM, Johan Edstrom <se...@gmail.com> wrote:
>> That looks right to me, if the transaction failed, there is no commit called on the DB record, effectively a "roll-back"?
>> On Apr 12, 2011, at 10:13 AM, Charles Moulliard wrote:
>>
>>> This is my feeling too.
>>>
>>> In the hsqldb.log, I do not see any commit
>>>
>>> SET AUTOCOMMIT TRUE
>>> /*C3*/INSERT INTO T_INCIDENT VALUES(1,'2011-04-12
>>> 18:08:10.000000000','file','this is a report incident for
>>> camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
>>> 00:03:00.000000000','001','+111 10 20 300','incident camel-001')
>>> /*C9*/DISCONNECT
>>> /*C3*/INSERT INTO T_INCIDENT VALUES(2,'2011-04-12
>>> 18:09:57.000000000','file','this is a report incident for
>>> camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
>>> 00:03:00.000000000','001','+111 10 20 300','incident camel-001')
>>>
>>>
>>> and tracing of openjpa is difficult to interpret
>>>
>>> 7125 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Preparing mapping for
>>> "com.fusesource.webinars.persistence.model.Incident".
>>> 7126 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Processing registered persistence-capable class
>>> "class com.fusesource.webinars.persistence.model.Incident".
>>> 7126 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
>>> 7127 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "incidentId" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy".
>>> 7127 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
>>> 7128 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "creationDate" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
>>> 7128 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
>>> 7129 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "creationUser" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7129 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.details".
>>> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "details" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.email".
>>> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "email" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7131 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
>>> 7131 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "familyName" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
>>> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "givenName" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
>>> 7133 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "incidentDate" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
>>> 7133 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
>>> 7134 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "incidentRef" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7134 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
>>> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "phone" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
>>> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - "summary" has mapping strategy
>>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>>> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData -
>>> "com.fusesource.webinars.persistence.model.Incident<discriminator>"
>>> has mapping strategy "none".
>>> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData -
>>> "com.fusesource.webinars.persistence.model.Incident<version>" has
>>> mapping strategy "none".
>>> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving mapping for
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528".
>>> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData -
>>> "com.fusesource.webinars.persistence.model.Incident" has mapping
>>> strategy "full".
>>> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Initializing mapping for
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528".
>>> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
>>> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
>>> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.details".
>>> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.email".
>>> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
>>> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
>>> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
>>> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
>>> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
>>> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
>>> 7141 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.MetaData - Resolving field
>>> "com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
>>> 7145 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
>>> 7146 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
>>> 7157 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
>>> 7166 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
>>> 7167 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
>>> 7168 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.SQLDiag - flush: org.apache.openjpa.kernel.PNewState for
>>> oid=1
>>> 7171 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.JDBC - The batch limit is set to 0.
>>> 7186 reportincident TRACE [DefaultMessageListenerContainer-1]
>>> openjpa.jdbc.JDBC - <t 372693120, conn 1674444914> [1 ms] close
>>>
>>>
>>>
>>> On Tue, Apr 12, 2011 at 5:46 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>> No, but that looks like you close the connection before the rollback?
>>>> If you turn on TRACING in openjpa as well as looking at the hsqldb.log
>>>> it should show you where it is going wonky...
>>>>
>>>> I also use </transacted> in my camel routes but primarily have my daos used in
>>>> processors, i.e they will not even be used if something fails.
>>>>
>>>> /je
>>>>
>>>> On Apr 12, 2011, at 9:40 AM, Charles Moulliard wrote:
>>>>
>>>>> Many thank Johan.
>>>>>
>>>>> Does the rollback works for you ? This is not the case for me.
>>>>>
>>>>> In a camel transactional route using the Aries JTA Tx Manager, the
>>>>> message is well moved by ActiveMq to the DLQ but the record is not
>>>>> rollbacked from the DB and inserted.
>>>>>
>>>>> I see this message in the log :
>>>>>
>>>>> 17:33:18,181 | ERROR | tenerContainer-1 | xapool
>>>>> | 246 - wrap_mvn_com.experlog_xapool_1.5.0 - 0 |
>>>>> StandardXAPoolDataSource:connectionClosed Exception in
>>>>> connectionClosed:java.lang.IllegalStateException: Status is
>>>>> STATUS_ROLLEDBACK
>>>>>
>>>>> Have you also seen this message ?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Charles
>>>>>
>>>>> On Tue, Apr 12, 2011 at 4:24 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>>>> Charles, it does look right.
>>>>>>
>>>>>> Attaching 2 config files I know work.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> And the BP bundle that imports it for persistence.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Also is the bundle marked with
>>>>>>
>>>>>> Meta-Persistence: META-INF/persistence.xml
>>>>>>
>>>>>> In the manifest?
>>>>>>
>>>>>>
>>>>>> On Apr 12, 2011, at 8:20 AM, Charles Moulliard wrote:
>>>>>>
>>>>>>> Here is the config Johan
>>>>>>>
>>>>>>> ersistence config
>>>>>>> **********************
>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>
>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>
>>>>>>> <jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
>>>>>>>
>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>> Global Tx Management -->
>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>
>>>>>>> <class>com.fusesource.webinars.persistence.model.Incident</class>
>>>>>>>
>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>
>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>> <properties>
>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>
>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>> <property name="openjpa.Log"
>>>>>>> value="commons"/>
>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>> value="PUBLIC"/>
>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>> value="managed"/>
>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>
>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>> value="true"/>
>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>> value="managed"/>
>>>>>>> <property name="openjpa.ConnectionFactoryMode"
>>>>>>> value="managed"/>
>>>>>>> </properties>
>>>>>>>
>>>>>>> </persistence-unit>
>>>>>>> </persistence>
>>>>>>>
>>>>>>> On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>>>>>> What does your persistence look like?
>>>>>>>> You'll need something like
>>>>>>>>
>>>>>>>> <persistence 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"
>>>>>>>> version="2.0">
>>>>>>>>
>>>>>>>> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>> <jta-data-source>blueprint:comp/jta</jta-data-source>
>>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>> <!-- Entity classes here -->
>>>>>>>>
>>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>> <validation-mode>NONE</validation-mode>
>>>>>>>>
>>>>>>>> <properties>
>>>>>>>> <property name="openjpa.Multithreaded" value="true"/>
>>>>>>>> <property name="openjpa.TransactionMode" value="managed"/>
>>>>>>>> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
>>>>>>>> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
>>>>>>>> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
>>>>>>>> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
>>>>>>>> </properties>
>>>>>>>> </persistence-unit>
>>>>>>>>
>>>>>>>> </persistence>
>>>>>>>> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>>>>>>>>
>>>>>>>>> Looking at the stack trace, the problem seems to be in the JPA
>>>>>>>>> definition, as it does not hit the datasource.
>>>>>>>>> Can you list the services exported by the datasource bundle ?
>>>>>>>>> Also, do you have aries jndi installed ? As your config uses it to
>>>>>>>>> lookup the osgi service.
>>>>>>>>>
>>>>>>>>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>>>>>>>>> Here is the complete blueprint file to expose the datasource
>>>>>>>>>>
>>>>>>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>>>>>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>>>>>>>>
>>>>>>>>>> <cm:property-placeholder persistent-id="database" id="database">
>>>>>>>>>> <cm:default-properties>
>>>>>>>>>>
>>>>>>>>>> <!-- JDBC Drivers -->
>>>>>>>>>> <cm:property name="jdbc.driverClassName"
>>>>>>>>>> value="org.hsqldb.jdbcDriver"/>
>>>>>>>>>> <cm:property name="jdbc.url"
>>>>>>>>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>>>>>>>>> <cm:property name="jdbc.username" value="sa"/>
>>>>>>>>>> <cm:property name="jdbc.password" value=""/>
>>>>>>>>>>
>>>>>>>>>> <!-- Connection Pooling DBCP -->
>>>>>>>>>> <cm:property name="jdbc.initialSize" value="5"/>
>>>>>>>>>> <cm:property name="jdbc.maxActive" value="10"/>
>>>>>>>>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>>>>>>>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>>>>>>>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>>>>>>>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>>>>>>>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>>>>>>>>
>>>>>>>>>> </cm:default-properties>
>>>>>>>>>> </cm:property-placeholder>
>>>>>>>>>>
>>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>>> <service-properties>
>>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>>> </service-properties>
>>>>>>>>>> </service>
>>>>>>>>>>
>>>>>>>>>> <service auto-export="interfaces" ref="nonJTA">
>>>>>>>>>> <service-properties>
>>>>>>>>>> <entry key="transactional" value="false"/>
>>>>>>>>>> </service-properties>
>>>>>>>>>> </service>
>>>>>>>>>>
>>>>>>>>>> <!-- ###### JDBC Data Source ###### -->
>>>>>>>>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>>>>>>>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>>>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>>>>> <property name="user" value="${jdbc.username}"/>
>>>>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>>>>> </bean>
>>>>>>>>>>
>>>>>>>>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>>>>>>>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>>>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>>>>> <property name="username" value="${jdbc.username}"/>
>>>>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>>>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>>>>>>>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>>>>>>>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>>>>>>>>> <property name="defaultAutoCommit" value="false"/>
>>>>>>>>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>>>>>>>>> <property name="removeAbandonedTimeout"
>>>>>>>>>> value="${jdbc.removeAbandonedTimeout}"/>
>>>>>>>>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>>>>>>>>> </bean>
>>>>>>>>>>
>>>>>>>>>> </blueprint>
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>>
>>>>>>>>>> Charles
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>>>>>>>>> Halo Charles,
>>>>>>>>>>>
>>>>>>>>>>> I think that you didn't paste the actual data source.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>>>>>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>>>>>>>>> error :
>>>>>>>>>>>>
>>>>>>>>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>>>>>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>>>>>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>>>>>> at
>>>>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>>>>> at
>>>>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>>>>> at
>>>>>>>>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> The property
>>>>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>>>>>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>>>>>>>>> osgi service
>>>>>>>>>>>>
>>>>>>>>>>>> Persistence
>>>>>>>>>>>> **************
>>>>>>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>>>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>>>>>>> Global Tx Management -->
>>>>>>>>>>>>
>>>>>>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>>>>>>
>>>>>>>>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>>>>>>>>
>>>>>>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>>>>>>
>>>>>>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>>>>>>> <properties>
>>>>>>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>>>>>>
>>>>>>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>>>>>>> <property name="openjpa.Log"
>>>>>>>>>>>> value="commons"/>
>>>>>>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>>>>>>> value="PUBLIC"/>
>>>>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>>>>> value="managed"/>
>>>>>>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>>>>>>> value="true"/>
>>>>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>>>>> value="managed"/>
>>>>>>>>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>>>>>>>>> value="managed"/>-->
>>>>>>>>>>>> </properties>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Blueprint config of the DataSource
>>>>>>>>>>>> ****************************************
>>>>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>>>>> <service-properties>
>>>>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>>>>> </service-properties>
>>>>>>>>>>>> </service>
>>>>>>>>>>>>
>>>>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>>>>> <service-properties>
>>>>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>>>>> </service-properties>
>>>>>>>>>>>> </service>
>>>>>>>>>>>>
>>>>>>>>>>>> Any idea is welcome.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Regards,
>>>>>>>>>>>>
>>>>>>>>>>>> Charles Moulliard
>>>>>>>>>>>>
>>>>>>>>>>>> Sr. Principal Solution Architect - FuseSource
>>>>>>>>>>>> Apache Committer
>>>>>>>>>>>>
>>>>>>>>>>>> Blog : http://cmoulliard.blogspot.com
>>>>>>>>>>>> Twitter : http://twitter.com/cmoulliard
>>>>>>>>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>>>>>>> Skype: cmoulliard
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> *Ioannis Canellos*
>>>>>>>>>>> *
>>>>>>>>>>> http://iocanel.blogspot.com
>>>>>>>>>>>
>>>>>>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>>>>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>>>>>>>>> *
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Cheers,
>>>>>>>>> Guillaume Nodet
>>>>>>>>> ------------------------
>>>>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>>>>> ------------------------
>>>>>>>>> Open Source SOA
>>>>>>>>> http://fusesource.com
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
I have found the reason.
The Tx Manager configured in my spring config file was for the
following interface
org.springframework.transaction.PlatformTransactionManager and not
javax.transaction.Transaction
<tx:annotation-driven transaction-manager="txManager"/>
<osgi:reference id="txManager"
interface="javax.transaction.TransactionManager"/>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="reportincident"/>
</bean>
That works now. Rollback occurs.
Cheers
Charles
On Tue, Apr 12, 2011 at 7:01 PM, Johan Edstrom <se...@gmail.com> wrote:
> That looks right to me, if the transaction failed, there is no commit called on the DB record, effectively a "roll-back"?
> On Apr 12, 2011, at 10:13 AM, Charles Moulliard wrote:
>
>> This is my feeling too.
>>
>> In the hsqldb.log, I do not see any commit
>>
>> SET AUTOCOMMIT TRUE
>> /*C3*/INSERT INTO T_INCIDENT VALUES(1,'2011-04-12
>> 18:08:10.000000000','file','this is a report incident for
>> camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
>> 00:03:00.000000000','001','+111 10 20 300','incident camel-001')
>> /*C9*/DISCONNECT
>> /*C3*/INSERT INTO T_INCIDENT VALUES(2,'2011-04-12
>> 18:09:57.000000000','file','this is a report incident for
>> camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
>> 00:03:00.000000000','001','+111 10 20 300','incident camel-001')
>>
>>
>> and tracing of openjpa is difficult to interpret
>>
>> 7125 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Preparing mapping for
>> "com.fusesource.webinars.persistence.model.Incident".
>> 7126 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Processing registered persistence-capable class
>> "class com.fusesource.webinars.persistence.model.Incident".
>> 7126 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
>> 7127 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "incidentId" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy".
>> 7127 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
>> 7128 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "creationDate" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
>> 7128 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
>> 7129 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "creationUser" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7129 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.details".
>> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "details" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.email".
>> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "email" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7131 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
>> 7131 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "familyName" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
>> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "givenName" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
>> 7133 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "incidentDate" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
>> 7133 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
>> 7134 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "incidentRef" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7134 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
>> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "phone" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
>> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - "summary" has mapping strategy
>> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
>> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData -
>> "com.fusesource.webinars.persistence.model.Incident<discriminator>"
>> has mapping strategy "none".
>> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData -
>> "com.fusesource.webinars.persistence.model.Incident<version>" has
>> mapping strategy "none".
>> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving mapping for
>> "com.fusesource.webinars.persistence.model.Incident@1310743528".
>> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData -
>> "com.fusesource.webinars.persistence.model.Incident" has mapping
>> strategy "full".
>> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Initializing mapping for
>> "com.fusesource.webinars.persistence.model.Incident@1310743528".
>> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
>> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
>> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.details".
>> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.email".
>> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
>> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
>> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
>> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
>> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
>> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
>> 7141 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.MetaData - Resolving field
>> "com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
>> 7145 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
>> 7146 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
>> 7157 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
>> 7166 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
>> 7167 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
>> 7168 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.SQLDiag - flush: org.apache.openjpa.kernel.PNewState for
>> oid=1
>> 7171 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.JDBC - The batch limit is set to 0.
>> 7186 reportincident TRACE [DefaultMessageListenerContainer-1]
>> openjpa.jdbc.JDBC - <t 372693120, conn 1674444914> [1 ms] close
>>
>>
>>
>> On Tue, Apr 12, 2011 at 5:46 PM, Johan Edstrom <se...@gmail.com> wrote:
>>> No, but that looks like you close the connection before the rollback?
>>> If you turn on TRACING in openjpa as well as looking at the hsqldb.log
>>> it should show you where it is going wonky...
>>>
>>> I also use </transacted> in my camel routes but primarily have my daos used in
>>> processors, i.e they will not even be used if something fails.
>>>
>>> /je
>>>
>>> On Apr 12, 2011, at 9:40 AM, Charles Moulliard wrote:
>>>
>>>> Many thank Johan.
>>>>
>>>> Does the rollback works for you ? This is not the case for me.
>>>>
>>>> In a camel transactional route using the Aries JTA Tx Manager, the
>>>> message is well moved by ActiveMq to the DLQ but the record is not
>>>> rollbacked from the DB and inserted.
>>>>
>>>> I see this message in the log :
>>>>
>>>> 17:33:18,181 | ERROR | tenerContainer-1 | xapool
>>>> | 246 - wrap_mvn_com.experlog_xapool_1.5.0 - 0 |
>>>> StandardXAPoolDataSource:connectionClosed Exception in
>>>> connectionClosed:java.lang.IllegalStateException: Status is
>>>> STATUS_ROLLEDBACK
>>>>
>>>> Have you also seen this message ?
>>>>
>>>> Regards,
>>>>
>>>> Charles
>>>>
>>>> On Tue, Apr 12, 2011 at 4:24 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>>> Charles, it does look right.
>>>>>
>>>>> Attaching 2 config files I know work.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> And the BP bundle that imports it for persistence.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Also is the bundle marked with
>>>>>
>>>>> Meta-Persistence: META-INF/persistence.xml
>>>>>
>>>>> In the manifest?
>>>>>
>>>>>
>>>>> On Apr 12, 2011, at 8:20 AM, Charles Moulliard wrote:
>>>>>
>>>>>> Here is the config Johan
>>>>>>
>>>>>> ersistence config
>>>>>> **********************
>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>
>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>
>>>>>> <jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
>>>>>>
>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>> Global Tx Management -->
>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>
>>>>>> <class>com.fusesource.webinars.persistence.model.Incident</class>
>>>>>>
>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>
>>>>>> <!-- openjpa & HSQLDB -->
>>>>>> <properties>
>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>
>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>> <property name="openjpa.Log"
>>>>>> value="commons"/>
>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>> value="PUBLIC"/>
>>>>>> <property name="openjpa.TransactionMode"
>>>>>> value="managed"/>
>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>
>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>> <property name="openjpa.Multithreaded"
>>>>>> value="true"/>
>>>>>> <property name="openjpa.TransactionMode"
>>>>>> value="managed"/>
>>>>>> <property name="openjpa.ConnectionFactoryMode"
>>>>>> value="managed"/>
>>>>>> </properties>
>>>>>>
>>>>>> </persistence-unit>
>>>>>> </persistence>
>>>>>>
>>>>>> On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>>>>> What does your persistence look like?
>>>>>>> You'll need something like
>>>>>>>
>>>>>>> <persistence 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"
>>>>>>> version="2.0">
>>>>>>>
>>>>>>> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>> <jta-data-source>blueprint:comp/jta</jta-data-source>
>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>> <!-- Entity classes here -->
>>>>>>>
>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>> <validation-mode>NONE</validation-mode>
>>>>>>>
>>>>>>> <properties>
>>>>>>> <property name="openjpa.Multithreaded" value="true"/>
>>>>>>> <property name="openjpa.TransactionMode" value="managed"/>
>>>>>>> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
>>>>>>> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
>>>>>>> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
>>>>>>> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
>>>>>>> </properties>
>>>>>>> </persistence-unit>
>>>>>>>
>>>>>>> </persistence>
>>>>>>> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>>>>>>>
>>>>>>>> Looking at the stack trace, the problem seems to be in the JPA
>>>>>>>> definition, as it does not hit the datasource.
>>>>>>>> Can you list the services exported by the datasource bundle ?
>>>>>>>> Also, do you have aries jndi installed ? As your config uses it to
>>>>>>>> lookup the osgi service.
>>>>>>>>
>>>>>>>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>>>>>>>> Here is the complete blueprint file to expose the datasource
>>>>>>>>>
>>>>>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>>>>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>>>>>>>
>>>>>>>>> <cm:property-placeholder persistent-id="database" id="database">
>>>>>>>>> <cm:default-properties>
>>>>>>>>>
>>>>>>>>> <!-- JDBC Drivers -->
>>>>>>>>> <cm:property name="jdbc.driverClassName"
>>>>>>>>> value="org.hsqldb.jdbcDriver"/>
>>>>>>>>> <cm:property name="jdbc.url"
>>>>>>>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>>>>>>>> <cm:property name="jdbc.username" value="sa"/>
>>>>>>>>> <cm:property name="jdbc.password" value=""/>
>>>>>>>>>
>>>>>>>>> <!-- Connection Pooling DBCP -->
>>>>>>>>> <cm:property name="jdbc.initialSize" value="5"/>
>>>>>>>>> <cm:property name="jdbc.maxActive" value="10"/>
>>>>>>>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>>>>>>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>>>>>>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>>>>>>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>>>>>>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>>>>>>>
>>>>>>>>> </cm:default-properties>
>>>>>>>>> </cm:property-placeholder>
>>>>>>>>>
>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>> <service-properties>
>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>> </service-properties>
>>>>>>>>> </service>
>>>>>>>>>
>>>>>>>>> <service auto-export="interfaces" ref="nonJTA">
>>>>>>>>> <service-properties>
>>>>>>>>> <entry key="transactional" value="false"/>
>>>>>>>>> </service-properties>
>>>>>>>>> </service>
>>>>>>>>>
>>>>>>>>> <!-- ###### JDBC Data Source ###### -->
>>>>>>>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>>>>>>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>>>> <property name="user" value="${jdbc.username}"/>
>>>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>>>> </bean>
>>>>>>>>>
>>>>>>>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>>>>>>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>>>> <property name="username" value="${jdbc.username}"/>
>>>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>>>>>>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>>>>>>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>>>>>>>> <property name="defaultAutoCommit" value="false"/>
>>>>>>>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>>>>>>>> <property name="removeAbandonedTimeout"
>>>>>>>>> value="${jdbc.removeAbandonedTimeout}"/>
>>>>>>>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>>>>>>>> </bean>
>>>>>>>>>
>>>>>>>>> </blueprint>
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Charles
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>>>>>>>> Halo Charles,
>>>>>>>>>>
>>>>>>>>>> I think that you didn't paste the actual data source.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>>>>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>>>>>>>> error :
>>>>>>>>>>>
>>>>>>>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>>>>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>>>>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>>>>> at
>>>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>>>> at
>>>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>>>> at
>>>>>>>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> The property
>>>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>>>>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>>>>>>>> osgi service
>>>>>>>>>>>
>>>>>>>>>>> Persistence
>>>>>>>>>>> **************
>>>>>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>>>>>> Global Tx Management -->
>>>>>>>>>>>
>>>>>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>>>>>
>>>>>>>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>>>>>>>
>>>>>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>>>>>
>>>>>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>>>>>> <properties>
>>>>>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>>>>>
>>>>>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>>>>>> <property name="openjpa.Log"
>>>>>>>>>>> value="commons"/>
>>>>>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>>>>>> value="PUBLIC"/>
>>>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>>>> value="managed"/>
>>>>>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>>>>>> value="true"/>
>>>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>>>> value="managed"/>
>>>>>>>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>>>>>>>> value="managed"/>-->
>>>>>>>>>>> </properties>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Blueprint config of the DataSource
>>>>>>>>>>> ****************************************
>>>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>>>> <service-properties>
>>>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>>>> </service-properties>
>>>>>>>>>>> </service>
>>>>>>>>>>>
>>>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>>>> <service-properties>
>>>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>>>> </service-properties>
>>>>>>>>>>> </service>
>>>>>>>>>>>
>>>>>>>>>>> Any idea is welcome.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>>
>>>>>>>>>>> Charles Moulliard
>>>>>>>>>>>
>>>>>>>>>>> Sr. Principal Solution Architect - FuseSource
>>>>>>>>>>> Apache Committer
>>>>>>>>>>>
>>>>>>>>>>> Blog : http://cmoulliard.blogspot.com
>>>>>>>>>>> Twitter : http://twitter.com/cmoulliard
>>>>>>>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>>>>>> Skype: cmoulliard
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> *Ioannis Canellos*
>>>>>>>>>> *
>>>>>>>>>> http://iocanel.blogspot.com
>>>>>>>>>>
>>>>>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>>>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>>>>>>>> *
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Cheers,
>>>>>>>> Guillaume Nodet
>>>>>>>> ------------------------
>>>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>>>> ------------------------
>>>>>>>> Open Source SOA
>>>>>>>> http://fusesource.com
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Johan Edstrom <se...@gmail.com>.
That looks right to me, if the transaction failed, there is no commit called on the DB record, effectively a "roll-back"?
On Apr 12, 2011, at 10:13 AM, Charles Moulliard wrote:
> This is my feeling too.
>
> In the hsqldb.log, I do not see any commit
>
> SET AUTOCOMMIT TRUE
> /*C3*/INSERT INTO T_INCIDENT VALUES(1,'2011-04-12
> 18:08:10.000000000','file','this is a report incident for
> camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
> 00:03:00.000000000','001','+111 10 20 300','incident camel-001')
> /*C9*/DISCONNECT
> /*C3*/INSERT INTO T_INCIDENT VALUES(2,'2011-04-12
> 18:09:57.000000000','file','this is a report incident for
> camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
> 00:03:00.000000000','001','+111 10 20 300','incident camel-001')
>
>
> and tracing of openjpa is difficult to interpret
>
> 7125 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Preparing mapping for
> "com.fusesource.webinars.persistence.model.Incident".
> 7126 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Processing registered persistence-capable class
> "class com.fusesource.webinars.persistence.model.Incident".
> 7126 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
> 7127 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "incidentId" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy".
> 7127 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
> 7128 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "creationDate" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
> 7128 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
> 7129 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "creationUser" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7129 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.details".
> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "details" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.email".
> 7130 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "email" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7131 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
> 7131 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "familyName" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "givenName" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7132 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
> 7133 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "incidentDate" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
> 7133 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
> 7134 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "incidentRef" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7134 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "phone" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
> 7135 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - "summary" has mapping strategy
> "org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData -
> "com.fusesource.webinars.persistence.model.Incident<discriminator>"
> has mapping strategy "none".
> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData -
> "com.fusesource.webinars.persistence.model.Incident<version>" has
> mapping strategy "none".
> 7136 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving mapping for
> "com.fusesource.webinars.persistence.model.Incident@1310743528".
> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData -
> "com.fusesource.webinars.persistence.model.Incident" has mapping
> strategy "full".
> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Initializing mapping for
> "com.fusesource.webinars.persistence.model.Incident@1310743528".
> 7137 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.details".
> 7138 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.email".
> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
> 7139 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
> 7140 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
> 7141 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.MetaData - Resolving field
> "com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
> 7145 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
> 7146 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
> 7157 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
> 7166 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
> 7167 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
> 7168 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.SQLDiag - flush: org.apache.openjpa.kernel.PNewState for
> oid=1
> 7171 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.JDBC - The batch limit is set to 0.
> 7186 reportincident TRACE [DefaultMessageListenerContainer-1]
> openjpa.jdbc.JDBC - <t 372693120, conn 1674444914> [1 ms] close
>
>
>
> On Tue, Apr 12, 2011 at 5:46 PM, Johan Edstrom <se...@gmail.com> wrote:
>> No, but that looks like you close the connection before the rollback?
>> If you turn on TRACING in openjpa as well as looking at the hsqldb.log
>> it should show you where it is going wonky...
>>
>> I also use </transacted> in my camel routes but primarily have my daos used in
>> processors, i.e they will not even be used if something fails.
>>
>> /je
>>
>> On Apr 12, 2011, at 9:40 AM, Charles Moulliard wrote:
>>
>>> Many thank Johan.
>>>
>>> Does the rollback works for you ? This is not the case for me.
>>>
>>> In a camel transactional route using the Aries JTA Tx Manager, the
>>> message is well moved by ActiveMq to the DLQ but the record is not
>>> rollbacked from the DB and inserted.
>>>
>>> I see this message in the log :
>>>
>>> 17:33:18,181 | ERROR | tenerContainer-1 | xapool
>>> | 246 - wrap_mvn_com.experlog_xapool_1.5.0 - 0 |
>>> StandardXAPoolDataSource:connectionClosed Exception in
>>> connectionClosed:java.lang.IllegalStateException: Status is
>>> STATUS_ROLLEDBACK
>>>
>>> Have you also seen this message ?
>>>
>>> Regards,
>>>
>>> Charles
>>>
>>> On Tue, Apr 12, 2011 at 4:24 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>> Charles, it does look right.
>>>>
>>>> Attaching 2 config files I know work.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> And the BP bundle that imports it for persistence.
>>>>
>>>>
>>>>
>>>>
>>>> Also is the bundle marked with
>>>>
>>>> Meta-Persistence: META-INF/persistence.xml
>>>>
>>>> In the manifest?
>>>>
>>>>
>>>> On Apr 12, 2011, at 8:20 AM, Charles Moulliard wrote:
>>>>
>>>>> Here is the config Johan
>>>>>
>>>>> ersistence config
>>>>> **********************
>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>
>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>
>>>>> <jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
>>>>>
>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>> Global Tx Management -->
>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>
>>>>> <class>com.fusesource.webinars.persistence.model.Incident</class>
>>>>>
>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>
>>>>> <!-- openjpa & HSQLDB -->
>>>>> <properties>
>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>
>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>> <property name="openjpa.Log"
>>>>> value="commons"/>
>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>> value="hsql(useSchemaName=true)"/>
>>>>> <property name="openjpa.jdbc.Schema"
>>>>> value="PUBLIC"/>
>>>>> <property name="openjpa.TransactionMode"
>>>>> value="managed"/>
>>>>> <property name="openjpa.ManagedRuntime"
>>>>>
>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>> <property name="openjpa.Multithreaded"
>>>>> value="true"/>
>>>>> <property name="openjpa.TransactionMode"
>>>>> value="managed"/>
>>>>> <property name="openjpa.ConnectionFactoryMode"
>>>>> value="managed"/>
>>>>> </properties>
>>>>>
>>>>> </persistence-unit>
>>>>> </persistence>
>>>>>
>>>>> On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>>>> What does your persistence look like?
>>>>>> You'll need something like
>>>>>>
>>>>>> <persistence 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"
>>>>>> version="2.0">
>>>>>>
>>>>>> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>> <jta-data-source>blueprint:comp/jta</jta-data-source>
>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>> <!-- Entity classes here -->
>>>>>>
>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>> <validation-mode>NONE</validation-mode>
>>>>>>
>>>>>> <properties>
>>>>>> <property name="openjpa.Multithreaded" value="true"/>
>>>>>> <property name="openjpa.TransactionMode" value="managed"/>
>>>>>> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
>>>>>> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
>>>>>> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
>>>>>> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
>>>>>> </properties>
>>>>>> </persistence-unit>
>>>>>>
>>>>>> </persistence>
>>>>>> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>>>>>>
>>>>>>> Looking at the stack trace, the problem seems to be in the JPA
>>>>>>> definition, as it does not hit the datasource.
>>>>>>> Can you list the services exported by the datasource bundle ?
>>>>>>> Also, do you have aries jndi installed ? As your config uses it to
>>>>>>> lookup the osgi service.
>>>>>>>
>>>>>>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>>>>>>> Here is the complete blueprint file to expose the datasource
>>>>>>>>
>>>>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>>>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>>>>>>
>>>>>>>> <cm:property-placeholder persistent-id="database" id="database">
>>>>>>>> <cm:default-properties>
>>>>>>>>
>>>>>>>> <!-- JDBC Drivers -->
>>>>>>>> <cm:property name="jdbc.driverClassName"
>>>>>>>> value="org.hsqldb.jdbcDriver"/>
>>>>>>>> <cm:property name="jdbc.url"
>>>>>>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>>>>>>> <cm:property name="jdbc.username" value="sa"/>
>>>>>>>> <cm:property name="jdbc.password" value=""/>
>>>>>>>>
>>>>>>>> <!-- Connection Pooling DBCP -->
>>>>>>>> <cm:property name="jdbc.initialSize" value="5"/>
>>>>>>>> <cm:property name="jdbc.maxActive" value="10"/>
>>>>>>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>>>>>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>>>>>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>>>>>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>>>>>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>>>>>>
>>>>>>>> </cm:default-properties>
>>>>>>>> </cm:property-placeholder>
>>>>>>>>
>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>> <service-properties>
>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>> </service-properties>
>>>>>>>> </service>
>>>>>>>>
>>>>>>>> <service auto-export="interfaces" ref="nonJTA">
>>>>>>>> <service-properties>
>>>>>>>> <entry key="transactional" value="false"/>
>>>>>>>> </service-properties>
>>>>>>>> </service>
>>>>>>>>
>>>>>>>> <!-- ###### JDBC Data Source ###### -->
>>>>>>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>>>>>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>>> <property name="user" value="${jdbc.username}"/>
>>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>>> </bean>
>>>>>>>>
>>>>>>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>>>>>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>>> <property name="username" value="${jdbc.username}"/>
>>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>>>>>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>>>>>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>>>>>>> <property name="defaultAutoCommit" value="false"/>
>>>>>>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>>>>>>> <property name="removeAbandonedTimeout"
>>>>>>>> value="${jdbc.removeAbandonedTimeout}"/>
>>>>>>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>>>>>>> </bean>
>>>>>>>>
>>>>>>>> </blueprint>
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Charles
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>>>>>>> Halo Charles,
>>>>>>>>>
>>>>>>>>> I think that you didn't paste the actual data source.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>>>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>>>>>>> error :
>>>>>>>>>>
>>>>>>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>>>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>>>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>>>> at
>>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>>> at
>>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>>> at
>>>>>>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> The property
>>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>>>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>>>>>>> osgi service
>>>>>>>>>>
>>>>>>>>>> Persistence
>>>>>>>>>> **************
>>>>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>>>>> Global Tx Management -->
>>>>>>>>>>
>>>>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>>>>
>>>>>>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>>>>>>
>>>>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>>>>
>>>>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>>>>> <properties>
>>>>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>>>>
>>>>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>>>>> <property name="openjpa.Log"
>>>>>>>>>> value="commons"/>
>>>>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>>>>> value="PUBLIC"/>
>>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>>> value="managed"/>
>>>>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>>>>> value="true"/>
>>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>>> value="managed"/>
>>>>>>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>>>>>>> value="managed"/>-->
>>>>>>>>>> </properties>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Blueprint config of the DataSource
>>>>>>>>>> ****************************************
>>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>>> <service-properties>
>>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>>> </service-properties>
>>>>>>>>>> </service>
>>>>>>>>>>
>>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>>> <service-properties>
>>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>>> </service-properties>
>>>>>>>>>> </service>
>>>>>>>>>>
>>>>>>>>>> Any idea is welcome.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>>
>>>>>>>>>> Charles Moulliard
>>>>>>>>>>
>>>>>>>>>> Sr. Principal Solution Architect - FuseSource
>>>>>>>>>> Apache Committer
>>>>>>>>>>
>>>>>>>>>> Blog : http://cmoulliard.blogspot.com
>>>>>>>>>> Twitter : http://twitter.com/cmoulliard
>>>>>>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>>>>> Skype: cmoulliard
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> *Ioannis Canellos*
>>>>>>>>> *
>>>>>>>>> http://iocanel.blogspot.com
>>>>>>>>>
>>>>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>>>>>>> *
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Cheers,
>>>>>>> Guillaume Nodet
>>>>>>> ------------------------
>>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>>> ------------------------
>>>>>>> Open Source SOA
>>>>>>> http://fusesource.com
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>
>>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
This is my feeling too.
In the hsqldb.log, I do not see any commit
SET AUTOCOMMIT TRUE
/*C3*/INSERT INTO T_INCIDENT VALUES(1,'2011-04-12
18:08:10.000000000','file','this is a report incident for
camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
00:03:00.000000000','001','+111 10 20 300','incident camel-001')
/*C9*/DISCONNECT
/*C3*/INSERT INTO T_INCIDENT VALUES(2,'2011-04-12
18:09:57.000000000','file','this is a report incident for
camel-001','cibsen@gmail.com','Ibsen','Claus','2011-01-22
00:03:00.000000000','001','+111 10 20 300','incident camel-001')
and tracing of openjpa is difficult to interpret
7125 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Preparing mapping for
"com.fusesource.webinars.persistence.model.Incident".
7126 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Processing registered persistence-capable class
"class com.fusesource.webinars.persistence.model.Incident".
7126 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
7127 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "incidentId" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.PrimitiveFieldStrategy".
7127 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
7128 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "creationDate" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
7128 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
7129 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "creationUser" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7129 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.details".
7130 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "details" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7130 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.email".
7130 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "email" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7131 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
7131 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "familyName" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7132 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
7132 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "givenName" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7132 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
7133 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "incidentDate" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy".
7133 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
7134 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "incidentRef" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7134 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
7135 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "phone" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7135 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
7135 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - "summary" has mapping strategy
"org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy".
7136 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData -
"com.fusesource.webinars.persistence.model.Incident<discriminator>"
has mapping strategy "none".
7136 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData -
"com.fusesource.webinars.persistence.model.Incident<version>" has
mapping strategy "none".
7136 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving mapping for
"com.fusesource.webinars.persistence.model.Incident@1310743528".
7137 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData -
"com.fusesource.webinars.persistence.model.Incident" has mapping
strategy "full".
7137 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Initializing mapping for
"com.fusesource.webinars.persistence.model.Incident@1310743528".
7137 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.creationDate".
7138 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.creationUser".
7138 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.details".
7138 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.email".
7139 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.familyName".
7139 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.givenName".
7139 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.incidentDate".
7140 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.incidentId".
7140 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.incidentRef".
7140 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.phone".
7141 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.MetaData - Resolving field
"com.fusesource.webinars.persistence.model.Incident@1310743528.summary".
7145 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
7146 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
7157 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
7166 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.JDBC - <t 372693120, conn 21370232> [0 ms] commit
7167 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.JDBC - <t 372693120, conn 0> [0 ms] close
7168 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.SQLDiag - flush: org.apache.openjpa.kernel.PNewState for
oid=1
7171 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.JDBC - The batch limit is set to 0.
7186 reportincident TRACE [DefaultMessageListenerContainer-1]
openjpa.jdbc.JDBC - <t 372693120, conn 1674444914> [1 ms] close
On Tue, Apr 12, 2011 at 5:46 PM, Johan Edstrom <se...@gmail.com> wrote:
> No, but that looks like you close the connection before the rollback?
> If you turn on TRACING in openjpa as well as looking at the hsqldb.log
> it should show you where it is going wonky...
>
> I also use </transacted> in my camel routes but primarily have my daos used in
> processors, i.e they will not even be used if something fails.
>
> /je
>
> On Apr 12, 2011, at 9:40 AM, Charles Moulliard wrote:
>
>> Many thank Johan.
>>
>> Does the rollback works for you ? This is not the case for me.
>>
>> In a camel transactional route using the Aries JTA Tx Manager, the
>> message is well moved by ActiveMq to the DLQ but the record is not
>> rollbacked from the DB and inserted.
>>
>> I see this message in the log :
>>
>> 17:33:18,181 | ERROR | tenerContainer-1 | xapool
>> | 246 - wrap_mvn_com.experlog_xapool_1.5.0 - 0 |
>> StandardXAPoolDataSource:connectionClosed Exception in
>> connectionClosed:java.lang.IllegalStateException: Status is
>> STATUS_ROLLEDBACK
>>
>> Have you also seen this message ?
>>
>> Regards,
>>
>> Charles
>>
>> On Tue, Apr 12, 2011 at 4:24 PM, Johan Edstrom <se...@gmail.com> wrote:
>>> Charles, it does look right.
>>>
>>> Attaching 2 config files I know work.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> And the BP bundle that imports it for persistence.
>>>
>>>
>>>
>>>
>>> Also is the bundle marked with
>>>
>>> Meta-Persistence: META-INF/persistence.xml
>>>
>>> In the manifest?
>>>
>>>
>>> On Apr 12, 2011, at 8:20 AM, Charles Moulliard wrote:
>>>
>>>> Here is the config Johan
>>>>
>>>> ersistence config
>>>> **********************
>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>
>>>> <jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
>>>>
>>>> <!-- Required by openJPA to update sequence table outside of
>>>> Global Tx Management -->
>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>
>>>> <class>com.fusesource.webinars.persistence.model.Incident</class>
>>>>
>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>
>>>> <!-- openjpa & HSQLDB -->
>>>> <properties>
>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>
>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>> <property name="openjpa.Log"
>>>> value="commons"/>
>>>> <property name="openjpa.jdbc.DBDictionary"
>>>> value="hsql(useSchemaName=true)"/>
>>>> <property name="openjpa.jdbc.Schema"
>>>> value="PUBLIC"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <property name="openjpa.ManagedRuntime"
>>>>
>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>> <property name="openjpa.Multithreaded"
>>>> value="true"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <property name="openjpa.ConnectionFactoryMode"
>>>> value="managed"/>
>>>> </properties>
>>>>
>>>> </persistence-unit>
>>>> </persistence>
>>>>
>>>> On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>>> What does your persistence look like?
>>>>> You'll need something like
>>>>>
>>>>> <persistence 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"
>>>>> version="2.0">
>>>>>
>>>>> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>> <jta-data-source>blueprint:comp/jta</jta-data-source>
>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>> <!-- Entity classes here -->
>>>>>
>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>> <validation-mode>NONE</validation-mode>
>>>>>
>>>>> <properties>
>>>>> <property name="openjpa.Multithreaded" value="true"/>
>>>>> <property name="openjpa.TransactionMode" value="managed"/>
>>>>> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
>>>>> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
>>>>> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
>>>>> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
>>>>> </properties>
>>>>> </persistence-unit>
>>>>>
>>>>> </persistence>
>>>>> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>>>>>
>>>>>> Looking at the stack trace, the problem seems to be in the JPA
>>>>>> definition, as it does not hit the datasource.
>>>>>> Can you list the services exported by the datasource bundle ?
>>>>>> Also, do you have aries jndi installed ? As your config uses it to
>>>>>> lookup the osgi service.
>>>>>>
>>>>>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>>>>>> Here is the complete blueprint file to expose the datasource
>>>>>>>
>>>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>>>>>
>>>>>>> <cm:property-placeholder persistent-id="database" id="database">
>>>>>>> <cm:default-properties>
>>>>>>>
>>>>>>> <!-- JDBC Drivers -->
>>>>>>> <cm:property name="jdbc.driverClassName"
>>>>>>> value="org.hsqldb.jdbcDriver"/>
>>>>>>> <cm:property name="jdbc.url"
>>>>>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>>>>>> <cm:property name="jdbc.username" value="sa"/>
>>>>>>> <cm:property name="jdbc.password" value=""/>
>>>>>>>
>>>>>>> <!-- Connection Pooling DBCP -->
>>>>>>> <cm:property name="jdbc.initialSize" value="5"/>
>>>>>>> <cm:property name="jdbc.maxActive" value="10"/>
>>>>>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>>>>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>>>>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>>>>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>>>>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>>>>>
>>>>>>> </cm:default-properties>
>>>>>>> </cm:property-placeholder>
>>>>>>>
>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>> <service-properties>
>>>>>>> <entry key="transactional" value="true"/>
>>>>>>> </service-properties>
>>>>>>> </service>
>>>>>>>
>>>>>>> <service auto-export="interfaces" ref="nonJTA">
>>>>>>> <service-properties>
>>>>>>> <entry key="transactional" value="false"/>
>>>>>>> </service-properties>
>>>>>>> </service>
>>>>>>>
>>>>>>> <!-- ###### JDBC Data Source ###### -->
>>>>>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>>>>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>> <property name="user" value="${jdbc.username}"/>
>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>> </bean>
>>>>>>>
>>>>>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>>>>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>>> <property name="username" value="${jdbc.username}"/>
>>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>>>>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>>>>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>>>>>> <property name="defaultAutoCommit" value="false"/>
>>>>>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>>>>>> <property name="removeAbandonedTimeout"
>>>>>>> value="${jdbc.removeAbandonedTimeout}"/>
>>>>>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>>>>>> </bean>
>>>>>>>
>>>>>>> </blueprint>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Charles
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>>>>>> Halo Charles,
>>>>>>>>
>>>>>>>> I think that you didn't paste the actual data source.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>>>>>> error :
>>>>>>>>>
>>>>>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>>> at
>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>> at
>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>> at
>>>>>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> The property
>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>>>>>> osgi service
>>>>>>>>>
>>>>>>>>> Persistence
>>>>>>>>> **************
>>>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>>>> Global Tx Management -->
>>>>>>>>>
>>>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>>>
>>>>>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>>>>>
>>>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>>>
>>>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>>>> <properties>
>>>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>>>
>>>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>>>> <property name="openjpa.Log"
>>>>>>>>> value="commons"/>
>>>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>>>> value="PUBLIC"/>
>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>> value="managed"/>
>>>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>>>> value="true"/>
>>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>>> value="managed"/>
>>>>>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>>>>>> value="managed"/>-->
>>>>>>>>> </properties>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Blueprint config of the DataSource
>>>>>>>>> ****************************************
>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>> <service-properties>
>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>> </service-properties>
>>>>>>>>> </service>
>>>>>>>>>
>>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>>> <service-properties>
>>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>>> </service-properties>
>>>>>>>>> </service>
>>>>>>>>>
>>>>>>>>> Any idea is welcome.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Charles Moulliard
>>>>>>>>>
>>>>>>>>> Sr. Principal Solution Architect - FuseSource
>>>>>>>>> Apache Committer
>>>>>>>>>
>>>>>>>>> Blog : http://cmoulliard.blogspot.com
>>>>>>>>> Twitter : http://twitter.com/cmoulliard
>>>>>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>>>> Skype: cmoulliard
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Ioannis Canellos*
>>>>>>>> *
>>>>>>>> http://iocanel.blogspot.com
>>>>>>>>
>>>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>>>>>> *
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Cheers,
>>>>>> Guillaume Nodet
>>>>>> ------------------------
>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>> ------------------------
>>>>>> Open Source SOA
>>>>>> http://fusesource.com
>>>>>
>>>>>
>>>
>>>
>>>
>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Johan Edstrom <se...@gmail.com>.
No, but that looks like you close the connection before the rollback?
If you turn on TRACING in openjpa as well as looking at the hsqldb.log
it should show you where it is going wonky...
I also use </transacted> in my camel routes but primarily have my daos used in
processors, i.e they will not even be used if something fails.
/je
On Apr 12, 2011, at 9:40 AM, Charles Moulliard wrote:
> Many thank Johan.
>
> Does the rollback works for you ? This is not the case for me.
>
> In a camel transactional route using the Aries JTA Tx Manager, the
> message is well moved by ActiveMq to the DLQ but the record is not
> rollbacked from the DB and inserted.
>
> I see this message in the log :
>
> 17:33:18,181 | ERROR | tenerContainer-1 | xapool
> | 246 - wrap_mvn_com.experlog_xapool_1.5.0 - 0 |
> StandardXAPoolDataSource:connectionClosed Exception in
> connectionClosed:java.lang.IllegalStateException: Status is
> STATUS_ROLLEDBACK
>
> Have you also seen this message ?
>
> Regards,
>
> Charles
>
> On Tue, Apr 12, 2011 at 4:24 PM, Johan Edstrom <se...@gmail.com> wrote:
>> Charles, it does look right.
>>
>> Attaching 2 config files I know work.
>>
>>
>>
>>
>>
>>
>>
>>
>> And the BP bundle that imports it for persistence.
>>
>>
>>
>>
>> Also is the bundle marked with
>>
>> Meta-Persistence: META-INF/persistence.xml
>>
>> In the manifest?
>>
>>
>> On Apr 12, 2011, at 8:20 AM, Charles Moulliard wrote:
>>
>>> Here is the config Johan
>>>
>>> ersistence config
>>> **********************
>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>
>>> <jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
>>>
>>> <!-- Required by openJPA to update sequence table outside of
>>> Global Tx Management -->
>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>
>>> <class>com.fusesource.webinars.persistence.model.Incident</class>
>>>
>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>
>>> <!-- openjpa & HSQLDB -->
>>> <properties>
>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>
>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>> <property name="openjpa.Log"
>>> value="commons"/>
>>> <property name="openjpa.jdbc.DBDictionary"
>>> value="hsql(useSchemaName=true)"/>
>>> <property name="openjpa.jdbc.Schema"
>>> value="PUBLIC"/>
>>> <property name="openjpa.TransactionMode"
>>> value="managed"/>
>>> <property name="openjpa.ManagedRuntime"
>>>
>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>> <property name="openjpa.Multithreaded"
>>> value="true"/>
>>> <property name="openjpa.TransactionMode"
>>> value="managed"/>
>>> <property name="openjpa.ConnectionFactoryMode"
>>> value="managed"/>
>>> </properties>
>>>
>>> </persistence-unit>
>>> </persistence>
>>>
>>> On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
>>>> What does your persistence look like?
>>>> You'll need something like
>>>>
>>>> <persistence 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"
>>>> version="2.0">
>>>>
>>>> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>> <jta-data-source>blueprint:comp/jta</jta-data-source>
>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>> <!-- Entity classes here -->
>>>>
>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>> <validation-mode>NONE</validation-mode>
>>>>
>>>> <properties>
>>>> <property name="openjpa.Multithreaded" value="true"/>
>>>> <property name="openjpa.TransactionMode" value="managed"/>
>>>> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
>>>> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
>>>> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
>>>> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
>>>> </properties>
>>>> </persistence-unit>
>>>>
>>>> </persistence>
>>>> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>>>>
>>>>> Looking at the stack trace, the problem seems to be in the JPA
>>>>> definition, as it does not hit the datasource.
>>>>> Can you list the services exported by the datasource bundle ?
>>>>> Also, do you have aries jndi installed ? As your config uses it to
>>>>> lookup the osgi service.
>>>>>
>>>>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>>>>> Here is the complete blueprint file to expose the datasource
>>>>>>
>>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>>>>
>>>>>> <cm:property-placeholder persistent-id="database" id="database">
>>>>>> <cm:default-properties>
>>>>>>
>>>>>> <!-- JDBC Drivers -->
>>>>>> <cm:property name="jdbc.driverClassName"
>>>>>> value="org.hsqldb.jdbcDriver"/>
>>>>>> <cm:property name="jdbc.url"
>>>>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>>>>> <cm:property name="jdbc.username" value="sa"/>
>>>>>> <cm:property name="jdbc.password" value=""/>
>>>>>>
>>>>>> <!-- Connection Pooling DBCP -->
>>>>>> <cm:property name="jdbc.initialSize" value="5"/>
>>>>>> <cm:property name="jdbc.maxActive" value="10"/>
>>>>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>>>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>>>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>>>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>>>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>>>>
>>>>>> </cm:default-properties>
>>>>>> </cm:property-placeholder>
>>>>>>
>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>> <service-properties>
>>>>>> <entry key="transactional" value="true"/>
>>>>>> </service-properties>
>>>>>> </service>
>>>>>>
>>>>>> <service auto-export="interfaces" ref="nonJTA">
>>>>>> <service-properties>
>>>>>> <entry key="transactional" value="false"/>
>>>>>> </service-properties>
>>>>>> </service>
>>>>>>
>>>>>> <!-- ###### JDBC Data Source ###### -->
>>>>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>>>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>> <property name="user" value="${jdbc.username}"/>
>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>> </bean>
>>>>>>
>>>>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>>>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>>>>> <property name="url" value="${jdbc.url}"/>
>>>>>> <property name="username" value="${jdbc.username}"/>
>>>>>> <property name="password" value="${jdbc.password}"/>
>>>>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>>>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>>>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>>>>> <property name="defaultAutoCommit" value="false"/>
>>>>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>>>>> <property name="removeAbandonedTimeout"
>>>>>> value="${jdbc.removeAbandonedTimeout}"/>
>>>>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>>>>> </bean>
>>>>>>
>>>>>> </blueprint>
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>>>>> Halo Charles,
>>>>>>>
>>>>>>> I think that you didn't paste the actual data source.
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>>>>> error :
>>>>>>>>
>>>>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>> at
>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>> at
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>> at
>>>>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>>>>
>>>>>>>>
>>>>>>>> The property
>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>>>>> osgi service
>>>>>>>>
>>>>>>>> Persistence
>>>>>>>> **************
>>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>>
>>>>>>>>
>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>
>>>>>>>>
>>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>>
>>>>>>>>
>>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>>> Global Tx Management -->
>>>>>>>>
>>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>>
>>>>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>>>>
>>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>>
>>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>>> <properties>
>>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>>
>>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>>> <property name="openjpa.Log"
>>>>>>>> value="commons"/>
>>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>>> value="PUBLIC"/>
>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>> value="managed"/>
>>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>>
>>>>>>>>
>>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>>> value="true"/>
>>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>>> value="managed"/>
>>>>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>>>>> value="managed"/>-->
>>>>>>>> </properties>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Blueprint config of the DataSource
>>>>>>>> ****************************************
>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>> <service-properties>
>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>> </service-properties>
>>>>>>>> </service>
>>>>>>>>
>>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>>> <service-properties>
>>>>>>>> <entry key="transactional" value="true"/>
>>>>>>>> </service-properties>
>>>>>>>> </service>
>>>>>>>>
>>>>>>>> Any idea is welcome.
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Charles Moulliard
>>>>>>>>
>>>>>>>> Sr. Principal Solution Architect - FuseSource
>>>>>>>> Apache Committer
>>>>>>>>
>>>>>>>> Blog : http://cmoulliard.blogspot.com
>>>>>>>> Twitter : http://twitter.com/cmoulliard
>>>>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>>> Skype: cmoulliard
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *Ioannis Canellos*
>>>>>>> *
>>>>>>> http://iocanel.blogspot.com
>>>>>>>
>>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>>>>> *
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Cheers,
>>>>> Guillaume Nodet
>>>>> ------------------------
>>>>> Blog: http://gnodet.blogspot.com/
>>>>> ------------------------
>>>>> Open Source SOA
>>>>> http://fusesource.com
>>>>
>>>>
>>
>>
>>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Many thank Johan.
Does the rollback works for you ? This is not the case for me.
In a camel transactional route using the Aries JTA Tx Manager, the
message is well moved by ActiveMq to the DLQ but the record is not
rollbacked from the DB and inserted.
I see this message in the log :
17:33:18,181 | ERROR | tenerContainer-1 | xapool
| 246 - wrap_mvn_com.experlog_xapool_1.5.0 - 0 |
StandardXAPoolDataSource:connectionClosed Exception in
connectionClosed:java.lang.IllegalStateException: Status is
STATUS_ROLLEDBACK
Have you also seen this message ?
Regards,
Charles
On Tue, Apr 12, 2011 at 4:24 PM, Johan Edstrom <se...@gmail.com> wrote:
> Charles, it does look right.
>
> Attaching 2 config files I know work.
>
>
>
>
>
>
>
>
> And the BP bundle that imports it for persistence.
>
>
>
>
> Also is the bundle marked with
>
> Meta-Persistence: META-INF/persistence.xml
>
> In the manifest?
>
>
> On Apr 12, 2011, at 8:20 AM, Charles Moulliard wrote:
>
>> Here is the config Johan
>>
>> ersistence config
>> **********************
>> <persistence-unit name="reportincident" transaction-type="JTA">
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>> <jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
>>
>> <!-- Required by openJPA to update sequence table outside of
>> Global Tx Management -->
>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>
>> <class>com.fusesource.webinars.persistence.model.Incident</class>
>>
>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>
>> <!-- openjpa & HSQLDB -->
>> <properties>
>> <property name="openjpa.jdbc.SynchronizeMappings"
>>
>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>> <property name="openjpa.Log"
>> value="commons"/>
>> <property name="openjpa.jdbc.DBDictionary"
>> value="hsql(useSchemaName=true)"/>
>> <property name="openjpa.jdbc.Schema"
>> value="PUBLIC"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ManagedRuntime"
>>
>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>> <property name="openjpa.Multithreaded"
>> value="true"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ConnectionFactoryMode"
>> value="managed"/>
>> </properties>
>>
>> </persistence-unit>
>> </persistence>
>>
>> On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
>>> What does your persistence look like?
>>> You'll need something like
>>>
>>> <persistence 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"
>>> version="2.0">
>>>
>>> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>> <jta-data-source>blueprint:comp/jta</jta-data-source>
>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>> <!-- Entity classes here -->
>>>
>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>> <validation-mode>NONE</validation-mode>
>>>
>>> <properties>
>>> <property name="openjpa.Multithreaded" value="true"/>
>>> <property name="openjpa.TransactionMode" value="managed"/>
>>> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
>>> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
>>> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
>>> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
>>> </properties>
>>> </persistence-unit>
>>>
>>> </persistence>
>>> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>>>
>>>> Looking at the stack trace, the problem seems to be in the JPA
>>>> definition, as it does not hit the datasource.
>>>> Can you list the services exported by the datasource bundle ?
>>>> Also, do you have aries jndi installed ? As your config uses it to
>>>> lookup the osgi service.
>>>>
>>>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>>>> Here is the complete blueprint file to expose the datasource
>>>>>
>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>>>
>>>>> <cm:property-placeholder persistent-id="database" id="database">
>>>>> <cm:default-properties>
>>>>>
>>>>> <!-- JDBC Drivers -->
>>>>> <cm:property name="jdbc.driverClassName"
>>>>> value="org.hsqldb.jdbcDriver"/>
>>>>> <cm:property name="jdbc.url"
>>>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>>>> <cm:property name="jdbc.username" value="sa"/>
>>>>> <cm:property name="jdbc.password" value=""/>
>>>>>
>>>>> <!-- Connection Pooling DBCP -->
>>>>> <cm:property name="jdbc.initialSize" value="5"/>
>>>>> <cm:property name="jdbc.maxActive" value="10"/>
>>>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>>>
>>>>> </cm:default-properties>
>>>>> </cm:property-placeholder>
>>>>>
>>>>> <service auto-export="interfaces" ref="jta">
>>>>> <service-properties>
>>>>> <entry key="transactional" value="true"/>
>>>>> </service-properties>
>>>>> </service>
>>>>>
>>>>> <service auto-export="interfaces" ref="nonJTA">
>>>>> <service-properties>
>>>>> <entry key="transactional" value="false"/>
>>>>> </service-properties>
>>>>> </service>
>>>>>
>>>>> <!-- ###### JDBC Data Source ###### -->
>>>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>>>> <property name="url" value="${jdbc.url}"/>
>>>>> <property name="user" value="${jdbc.username}"/>
>>>>> <property name="password" value="${jdbc.password}"/>
>>>>> </bean>
>>>>>
>>>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>>>> <property name="url" value="${jdbc.url}"/>
>>>>> <property name="username" value="${jdbc.username}"/>
>>>>> <property name="password" value="${jdbc.password}"/>
>>>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>>>> <property name="defaultAutoCommit" value="false"/>
>>>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>>>> <property name="removeAbandonedTimeout"
>>>>> value="${jdbc.removeAbandonedTimeout}"/>
>>>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>>>> </bean>
>>>>>
>>>>> </blueprint>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Charles
>>>>>
>>>>>
>>>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>>>> Halo Charles,
>>>>>>
>>>>>> I think that you didn't paste the actual data source.
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>>>> error :
>>>>>>>
>>>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>> at
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>> at
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>> at
>>>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>>>
>>>>>>>
>>>>>>> The property
>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>>>> osgi service
>>>>>>>
>>>>>>> Persistence
>>>>>>> **************
>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>
>>>>>>>
>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>
>>>>>>>
>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>
>>>>>>>
>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>> Global Tx Management -->
>>>>>>>
>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>
>>>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>>>
>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>
>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>> <properties>
>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>
>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>> <property name="openjpa.Log"
>>>>>>> value="commons"/>
>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>> value="PUBLIC"/>
>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>> value="managed"/>
>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>
>>>>>>>
>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>> value="true"/>
>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>> value="managed"/>
>>>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>>>> value="managed"/>-->
>>>>>>> </properties>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Blueprint config of the DataSource
>>>>>>> ****************************************
>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>> <service-properties>
>>>>>>> <entry key="transactional" value="true"/>
>>>>>>> </service-properties>
>>>>>>> </service>
>>>>>>>
>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>> <service-properties>
>>>>>>> <entry key="transactional" value="true"/>
>>>>>>> </service-properties>
>>>>>>> </service>
>>>>>>>
>>>>>>> Any idea is welcome.
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Charles Moulliard
>>>>>>>
>>>>>>> Sr. Principal Solution Architect - FuseSource
>>>>>>> Apache Committer
>>>>>>>
>>>>>>> Blog : http://cmoulliard.blogspot.com
>>>>>>> Twitter : http://twitter.com/cmoulliard
>>>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>> Skype: cmoulliard
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Ioannis Canellos*
>>>>>> *
>>>>>> http://iocanel.blogspot.com
>>>>>>
>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>>>> *
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> Guillaume Nodet
>>>> ------------------------
>>>> Blog: http://gnodet.blogspot.com/
>>>> ------------------------
>>>> Open Source SOA
>>>> http://fusesource.com
>>>
>>>
>
>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Hi Johan,
Thx for your files. They help me and now it works even when I setup
the LocalEntityManagerFactoryBean using Spring. There was a missing
bean in my DataSource config file.
Regards,
Charles
On Tue, Apr 12, 2011 at 4:24 PM, Johan Edstrom <se...@gmail.com> wrote:
> Charles, it does look right.
>
> Attaching 2 config files I know work.
>
>
>
>
>
>
>
>
> And the BP bundle that imports it for persistence.
>
>
>
>
> Also is the bundle marked with
>
> Meta-Persistence: META-INF/persistence.xml
>
> In the manifest?
>
>
> On Apr 12, 2011, at 8:20 AM, Charles Moulliard wrote:
>
>> Here is the config Johan
>>
>> ersistence config
>> **********************
>> <persistence-unit name="reportincident" transaction-type="JTA">
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>> <jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
>>
>> <!-- Required by openJPA to update sequence table outside of
>> Global Tx Management -->
>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>
>> <class>com.fusesource.webinars.persistence.model.Incident</class>
>>
>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>
>> <!-- openjpa & HSQLDB -->
>> <properties>
>> <property name="openjpa.jdbc.SynchronizeMappings"
>>
>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>> <property name="openjpa.Log"
>> value="commons"/>
>> <property name="openjpa.jdbc.DBDictionary"
>> value="hsql(useSchemaName=true)"/>
>> <property name="openjpa.jdbc.Schema"
>> value="PUBLIC"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ManagedRuntime"
>>
>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>> <property name="openjpa.Multithreaded"
>> value="true"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ConnectionFactoryMode"
>> value="managed"/>
>> </properties>
>>
>> </persistence-unit>
>> </persistence>
>>
>> On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
>>> What does your persistence look like?
>>> You'll need something like
>>>
>>> <persistence 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"
>>> version="2.0">
>>>
>>> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>> <jta-data-source>blueprint:comp/jta</jta-data-source>
>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>> <!-- Entity classes here -->
>>>
>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>> <validation-mode>NONE</validation-mode>
>>>
>>> <properties>
>>> <property name="openjpa.Multithreaded" value="true"/>
>>> <property name="openjpa.TransactionMode" value="managed"/>
>>> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
>>> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
>>> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
>>> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
>>> </properties>
>>> </persistence-unit>
>>>
>>> </persistence>
>>> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>>>
>>>> Looking at the stack trace, the problem seems to be in the JPA
>>>> definition, as it does not hit the datasource.
>>>> Can you list the services exported by the datasource bundle ?
>>>> Also, do you have aries jndi installed ? As your config uses it to
>>>> lookup the osgi service.
>>>>
>>>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>>>> Here is the complete blueprint file to expose the datasource
>>>>>
>>>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>>>
>>>>> <cm:property-placeholder persistent-id="database" id="database">
>>>>> <cm:default-properties>
>>>>>
>>>>> <!-- JDBC Drivers -->
>>>>> <cm:property name="jdbc.driverClassName"
>>>>> value="org.hsqldb.jdbcDriver"/>
>>>>> <cm:property name="jdbc.url"
>>>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>>>> <cm:property name="jdbc.username" value="sa"/>
>>>>> <cm:property name="jdbc.password" value=""/>
>>>>>
>>>>> <!-- Connection Pooling DBCP -->
>>>>> <cm:property name="jdbc.initialSize" value="5"/>
>>>>> <cm:property name="jdbc.maxActive" value="10"/>
>>>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>>>
>>>>> </cm:default-properties>
>>>>> </cm:property-placeholder>
>>>>>
>>>>> <service auto-export="interfaces" ref="jta">
>>>>> <service-properties>
>>>>> <entry key="transactional" value="true"/>
>>>>> </service-properties>
>>>>> </service>
>>>>>
>>>>> <service auto-export="interfaces" ref="nonJTA">
>>>>> <service-properties>
>>>>> <entry key="transactional" value="false"/>
>>>>> </service-properties>
>>>>> </service>
>>>>>
>>>>> <!-- ###### JDBC Data Source ###### -->
>>>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>>>> <property name="url" value="${jdbc.url}"/>
>>>>> <property name="user" value="${jdbc.username}"/>
>>>>> <property name="password" value="${jdbc.password}"/>
>>>>> </bean>
>>>>>
>>>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>>>> <property name="url" value="${jdbc.url}"/>
>>>>> <property name="username" value="${jdbc.username}"/>
>>>>> <property name="password" value="${jdbc.password}"/>
>>>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>>>> <property name="defaultAutoCommit" value="false"/>
>>>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>>>> <property name="removeAbandonedTimeout"
>>>>> value="${jdbc.removeAbandonedTimeout}"/>
>>>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>>>> </bean>
>>>>>
>>>>> </blueprint>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Charles
>>>>>
>>>>>
>>>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>>>> Halo Charles,
>>>>>>
>>>>>> I think that you didn't paste the actual data source.
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>>>> error :
>>>>>>>
>>>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>> at
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>> at
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>> at
>>>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>>>
>>>>>>>
>>>>>>> The property
>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>>>> osgi service
>>>>>>>
>>>>>>> Persistence
>>>>>>> **************
>>>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>>>
>>>>>>>
>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>
>>>>>>>
>>>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>>>
>>>>>>>
>>>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>>>> Global Tx Management -->
>>>>>>>
>>>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>>>
>>>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>>>
>>>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>>>
>>>>>>> <!-- openjpa & HSQLDB -->
>>>>>>> <properties>
>>>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>>>
>>>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>>>> <property name="openjpa.Log"
>>>>>>> value="commons"/>
>>>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>>>> value="hsql(useSchemaName=true)"/>
>>>>>>> <property name="openjpa.jdbc.Schema"
>>>>>>> value="PUBLIC"/>
>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>> value="managed"/>
>>>>>>> <property name="openjpa.ManagedRuntime"
>>>>>>>
>>>>>>>
>>>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>>>> <property name="openjpa.Multithreaded"
>>>>>>> value="true"/>
>>>>>>> <property name="openjpa.TransactionMode"
>>>>>>> value="managed"/>
>>>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>>>> value="managed"/>-->
>>>>>>> </properties>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Blueprint config of the DataSource
>>>>>>> ****************************************
>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>> <service-properties>
>>>>>>> <entry key="transactional" value="true"/>
>>>>>>> </service-properties>
>>>>>>> </service>
>>>>>>>
>>>>>>> <service auto-export="interfaces" ref="jta">
>>>>>>> <service-properties>
>>>>>>> <entry key="transactional" value="true"/>
>>>>>>> </service-properties>
>>>>>>> </service>
>>>>>>>
>>>>>>> Any idea is welcome.
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Charles Moulliard
>>>>>>>
>>>>>>> Sr. Principal Solution Architect - FuseSource
>>>>>>> Apache Committer
>>>>>>>
>>>>>>> Blog : http://cmoulliard.blogspot.com
>>>>>>> Twitter : http://twitter.com/cmoulliard
>>>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>>>> Skype: cmoulliard
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Ioannis Canellos*
>>>>>> *
>>>>>> http://iocanel.blogspot.com
>>>>>>
>>>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>>>> *
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> Guillaume Nodet
>>>> ------------------------
>>>> Blog: http://gnodet.blogspot.com/
>>>> ------------------------
>>>> Open Source SOA
>>>> http://fusesource.com
>>>
>>>
>
>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Johan Edstrom <se...@gmail.com>.
Charles, it does look right.
Attaching 2 config files I know work.
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Here is the config Johan
ersistence config
**********************
<persistence-unit name="reportincident" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
<!-- Required by openJPA to update sequence table outside of
Global Tx Management -->
<non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
<class>com.fusesource.webinars.persistence.model.Incident</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<!-- openjpa & HSQLDB -->
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(SchemaAction='add,deleteTableContents')"/>
<property name="openjpa.Log"
value="commons"/>
<property name="openjpa.jdbc.DBDictionary"
value="hsql(useSchemaName=true)"/>
<property name="openjpa.jdbc.Schema"
value="PUBLIC"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<property name="openjpa.ManagedRuntime"
value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
<property name="openjpa.Multithreaded"
value="true"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<property name="openjpa.ConnectionFactoryMode"
value="managed"/>
</properties>
</persistence-unit>
</persistence>
On Tue, Apr 12, 2011 at 4:08 PM, Johan Edstrom <se...@gmail.com> wrote:
> What does your persistence look like?
> You'll need something like
>
> <persistence 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"
> version="2.0">
>
> <persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> <jta-data-source>blueprint:comp/jta</jta-data-source>
> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
> <!-- Entity classes here -->
>
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
> <validation-mode>NONE</validation-mode>
>
> <properties>
> <property name="openjpa.Multithreaded" value="true"/>
> <property name="openjpa.TransactionMode" value="managed"/>
> <property name="openjpa.ConnectionFactoryMode" value="managed"/>
> <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
> <property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
> <property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
> </properties>
> </persistence-unit>
>
> </persistence>
> On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
>
>> Looking at the stack trace, the problem seems to be in the JPA
>> definition, as it does not hit the datasource.
>> Can you list the services exported by the datasource bundle ?
>> Also, do you have aries jndi installed ? As your config uses it to
>> lookup the osgi service.
>>
>> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>>> Here is the complete blueprint file to expose the datasource
>>>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>>
>>> <cm:property-placeholder persistent-id="database" id="database">
>>> <cm:default-properties>
>>>
>>> <!-- JDBC Drivers -->
>>> <cm:property name="jdbc.driverClassName"
>>> value="org.hsqldb.jdbcDriver"/>
>>> <cm:property name="jdbc.url"
>>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>>> <cm:property name="jdbc.username" value="sa"/>
>>> <cm:property name="jdbc.password" value=""/>
>>>
>>> <!-- Connection Pooling DBCP -->
>>> <cm:property name="jdbc.initialSize" value="5"/>
>>> <cm:property name="jdbc.maxActive" value="10"/>
>>> <cm:property name="jdbc.maxIdle" value="10"/>
>>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>>
>>> </cm:default-properties>
>>> </cm:property-placeholder>
>>>
>>> <service auto-export="interfaces" ref="jta">
>>> <service-properties>
>>> <entry key="transactional" value="true"/>
>>> </service-properties>
>>> </service>
>>>
>>> <service auto-export="interfaces" ref="nonJTA">
>>> <service-properties>
>>> <entry key="transactional" value="false"/>
>>> </service-properties>
>>> </service>
>>>
>>> <!-- ###### JDBC Data Source ###### -->
>>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>>> <property name="driverName" value="${jdbc.driverClassName}"/>
>>> <property name="url" value="${jdbc.url}"/>
>>> <property name="user" value="${jdbc.username}"/>
>>> <property name="password" value="${jdbc.password}"/>
>>> </bean>
>>>
>>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>>> <property name="url" value="${jdbc.url}"/>
>>> <property name="username" value="${jdbc.username}"/>
>>> <property name="password" value="${jdbc.password}"/>
>>> <property name="initialSize" value="${jdbc.initialSize}"/>
>>> <property name="maxActive" value="${jdbc.maxActive}"/>
>>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>>> <property name="defaultAutoCommit" value="false"/>
>>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>>> <property name="removeAbandonedTimeout"
>>> value="${jdbc.removeAbandonedTimeout}"/>
>>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>>> </bean>
>>>
>>> </blueprint>
>>>
>>> Regards,
>>>
>>> Charles
>>>
>>>
>>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>>> Halo Charles,
>>>>
>>>> I think that you didn't paste the actual data source.
>>>>
>>>>
>>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>>> when I try to insert data in the DB, openJPA generates the following
>>>>> error :
>>>>>
>>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>> at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at
>>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>>
>>>>>
>>>>> The property
>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>>> osgi service
>>>>>
>>>>> Persistence
>>>>> **************
>>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>>
>>>>>
>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>
>>>>>
>>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>>
>>>>>
>>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>>> <!-- Required by openJPA to update sequence table outside of
>>>>> Global Tx Management -->
>>>>>
>>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>>
>>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>>
>>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>>
>>>>> <!-- openjpa & HSQLDB -->
>>>>> <properties>
>>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>>
>>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>>> <property name="openjpa.Log"
>>>>> value="commons"/>
>>>>> <property name="openjpa.jdbc.DBDictionary"
>>>>> value="hsql(useSchemaName=true)"/>
>>>>> <property name="openjpa.jdbc.Schema"
>>>>> value="PUBLIC"/>
>>>>> <property name="openjpa.TransactionMode"
>>>>> value="managed"/>
>>>>> <property name="openjpa.ManagedRuntime"
>>>>>
>>>>>
>>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>>> <property name="openjpa.Multithreaded"
>>>>> value="true"/>
>>>>> <property name="openjpa.TransactionMode"
>>>>> value="managed"/>
>>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>>> value="managed"/>-->
>>>>> </properties>
>>>>>
>>>>>
>>>>>
>>>>> Blueprint config of the DataSource
>>>>> ****************************************
>>>>> <service auto-export="interfaces" ref="jta">
>>>>> <service-properties>
>>>>> <entry key="transactional" value="true"/>
>>>>> </service-properties>
>>>>> </service>
>>>>>
>>>>> <service auto-export="interfaces" ref="jta">
>>>>> <service-properties>
>>>>> <entry key="transactional" value="true"/>
>>>>> </service-properties>
>>>>> </service>
>>>>>
>>>>> Any idea is welcome.
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Charles Moulliard
>>>>>
>>>>> Sr. Principal Solution Architect - FuseSource
>>>>> Apache Committer
>>>>>
>>>>> Blog : http://cmoulliard.blogspot.com
>>>>> Twitter : http://twitter.com/cmoulliard
>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>>> Skype: cmoulliard
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Ioannis Canellos*
>>>> *
>>>> http://iocanel.blogspot.com
>>>>
>>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>>> *
>>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Johan Edstrom <se...@gmail.com>.
What does your persistence look like?
You'll need something like
<persistence 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"
version="2.0">
<persistence-unit name="mymagical-jpa-unit" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>blueprint:comp/jta</jta-data-source>
<non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
<!-- Entity classes here -->
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<validation-mode>NONE</validation-mode>
<properties>
<property name="openjpa.Multithreaded" value="true"/>
<property name="openjpa.TransactionMode" value="managed"/>
<property name="openjpa.ConnectionFactoryMode" value="managed"/>
<property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>
<property name="openjpa.LockManager" value="pessimistic(VersionCheckOnReadLock=true,VersionUpdateOnWriteLock=true)"/>
<property name="openjpa.Log" value="DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"/>
</properties>
</persistence-unit>
</persistence>
On Apr 12, 2011, at 7:43 AM, Guillaume Nodet wrote:
> Looking at the stack trace, the problem seems to be in the JPA
> definition, as it does not hit the datasource.
> Can you list the services exported by the datasource bundle ?
> Also, do you have aries jndi installed ? As your config uses it to
> lookup the osgi service.
>
> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>> Here is the complete blueprint file to expose the datasource
>>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>
>> <cm:property-placeholder persistent-id="database" id="database">
>> <cm:default-properties>
>>
>> <!-- JDBC Drivers -->
>> <cm:property name="jdbc.driverClassName"
>> value="org.hsqldb.jdbcDriver"/>
>> <cm:property name="jdbc.url"
>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>> <cm:property name="jdbc.username" value="sa"/>
>> <cm:property name="jdbc.password" value=""/>
>>
>> <!-- Connection Pooling DBCP -->
>> <cm:property name="jdbc.initialSize" value="5"/>
>> <cm:property name="jdbc.maxActive" value="10"/>
>> <cm:property name="jdbc.maxIdle" value="10"/>
>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>
>> </cm:default-properties>
>> </cm:property-placeholder>
>>
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> <service auto-export="interfaces" ref="nonJTA">
>> <service-properties>
>> <entry key="transactional" value="false"/>
>> </service-properties>
>> </service>
>>
>> <!-- ###### JDBC Data Source ###### -->
>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>> <property name="driverName" value="${jdbc.driverClassName}"/>
>> <property name="url" value="${jdbc.url}"/>
>> <property name="user" value="${jdbc.username}"/>
>> <property name="password" value="${jdbc.password}"/>
>> </bean>
>>
>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>> <property name="url" value="${jdbc.url}"/>
>> <property name="username" value="${jdbc.username}"/>
>> <property name="password" value="${jdbc.password}"/>
>> <property name="initialSize" value="${jdbc.initialSize}"/>
>> <property name="maxActive" value="${jdbc.maxActive}"/>
>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>> <property name="defaultAutoCommit" value="false"/>
>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>> <property name="removeAbandonedTimeout"
>> value="${jdbc.removeAbandonedTimeout}"/>
>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>> </bean>
>>
>> </blueprint>
>>
>> Regards,
>>
>> Charles
>>
>>
>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>> Halo Charles,
>>>
>>> I think that you didn't paste the actual data source.
>>>
>>>
>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>> when I try to insert data in the DB, openJPA generates the following
>>>> error :
>>>>
>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at
>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>
>>>>
>>>> The property
>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>> osgi service
>>>>
>>>> Persistence
>>>> **************
>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>
>>>>
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>
>>>>
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>
>>>>
>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>> <!-- Required by openJPA to update sequence table outside of
>>>> Global Tx Management -->
>>>>
>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>
>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>
>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>
>>>> <!-- openjpa & HSQLDB -->
>>>> <properties>
>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>
>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>> <property name="openjpa.Log"
>>>> value="commons"/>
>>>> <property name="openjpa.jdbc.DBDictionary"
>>>> value="hsql(useSchemaName=true)"/>
>>>> <property name="openjpa.jdbc.Schema"
>>>> value="PUBLIC"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <property name="openjpa.ManagedRuntime"
>>>>
>>>>
>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>> <property name="openjpa.Multithreaded"
>>>> value="true"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>> value="managed"/>-->
>>>> </properties>
>>>>
>>>>
>>>>
>>>> Blueprint config of the DataSource
>>>> ****************************************
>>>> <service auto-export="interfaces" ref="jta">
>>>> <service-properties>
>>>> <entry key="transactional" value="true"/>
>>>> </service-properties>
>>>> </service>
>>>>
>>>> <service auto-export="interfaces" ref="jta">
>>>> <service-properties>
>>>> <entry key="transactional" value="true"/>
>>>> </service-properties>
>>>> </service>
>>>>
>>>> Any idea is welcome.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>>
>>>> Sr. Principal Solution Architect - FuseSource
>>>> Apache Committer
>>>>
>>>> Blog : http://cmoulliard.blogspot.com
>>>> Twitter : http://twitter.com/cmoulliard
>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>> Skype: cmoulliard
>>>>
>>>
>>>
>>>
>>> --
>>> *Ioannis Canellos*
>>> *
>>> http://iocanel.blogspot.com
>>>
>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>> *
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Hi Guillaume,
The interfaces of the DataSource and XADatasource are well exposed
karaf@root> ls 249
FuseSource :: Webinars :: Fuse ESB & Persistence :: Database (249) provides:
----------------------------------------------------------------------------
objectClass = javax.sql.XADataSource
osgi.service.blueprint.compname = jta
service.id = 171
transactional = true
----
objectClass = javax.sql.DataSource
osgi.service.blueprint.compname = nonJTA
service.id = 172
transactional = false
----
objectClass = org.osgi.service.blueprint.container.BlueprintContainer
osgi.blueprint.container.symbolicname = database
osgi.blueprint.container.version = 1.0.0
service.id = 173
and aries jndi is deployed
karaf@root> list | grep -i jndi
[ 144] [Active ] [ ] [ ] [ 60] Apache Aries
JNDI API (0.2.0.incubating)
[ 145] [Active ] [ ] [ ] [ 60] Apache Aries
JNDI Core (0.2.0.incubating)
[ 146] [Active ] [ ] [ ] [ 60] Apache Aries
JNDI URL Handler (0.2.0.incubating)
BTW, I have made a small modification in the spring definition and now
openJPA is not able to cast a XADataSource !!
Persistence config
**********************
<persistence-unit name="reportincident" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
<!-- Required by openJPA to update sequence table outside of
Global Tx Management -->
<non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
<class>com.fusesource.webinars.persistence.model.Incident</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<!-- openjpa & HSQLDB -->
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(SchemaAction='add,deleteTableContents')"/>
<property name="openjpa.Log"
value="commons"/>
<property name="openjpa.jdbc.DBDictionary"
value="hsql(useSchemaName=true)"/>
<property name="openjpa.jdbc.Schema"
value="PUBLIC"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<property name="openjpa.ManagedRuntime"
value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
<property name="openjpa.Multithreaded"
value="true"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<property name="openjpa.ConnectionFactoryMode"
value="managed"/>
</properties>
</persistence-unit>
</persistence>
Spring config
***************
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="reportincident"/>
</bean>
Regards,
Charles
On Tue, Apr 12, 2011 at 3:43 PM, Guillaume Nodet <gn...@gmail.com> wrote:
> Looking at the stack trace, the problem seems to be in the JPA
> definition, as it does not hit the datasource.
> Can you list the services exported by the datasource bundle ?
> Also, do you have aries jndi installed ? As your config uses it to
> lookup the osgi service.
>
> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>> Here is the complete blueprint file to expose the datasource
>>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>
>> <cm:property-placeholder persistent-id="database" id="database">
>> <cm:default-properties>
>>
>> <!-- JDBC Drivers -->
>> <cm:property name="jdbc.driverClassName"
>> value="org.hsqldb.jdbcDriver"/>
>> <cm:property name="jdbc.url"
>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>> <cm:property name="jdbc.username" value="sa"/>
>> <cm:property name="jdbc.password" value=""/>
>>
>> <!-- Connection Pooling DBCP -->
>> <cm:property name="jdbc.initialSize" value="5"/>
>> <cm:property name="jdbc.maxActive" value="10"/>
>> <cm:property name="jdbc.maxIdle" value="10"/>
>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>
>> </cm:default-properties>
>> </cm:property-placeholder>
>>
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> <service auto-export="interfaces" ref="nonJTA">
>> <service-properties>
>> <entry key="transactional" value="false"/>
>> </service-properties>
>> </service>
>>
>> <!-- ###### JDBC Data Source ###### -->
>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>> <property name="driverName" value="${jdbc.driverClassName}"/>
>> <property name="url" value="${jdbc.url}"/>
>> <property name="user" value="${jdbc.username}"/>
>> <property name="password" value="${jdbc.password}"/>
>> </bean>
>>
>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>> <property name="url" value="${jdbc.url}"/>
>> <property name="username" value="${jdbc.username}"/>
>> <property name="password" value="${jdbc.password}"/>
>> <property name="initialSize" value="${jdbc.initialSize}"/>
>> <property name="maxActive" value="${jdbc.maxActive}"/>
>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>> <property name="defaultAutoCommit" value="false"/>
>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>> <property name="removeAbandonedTimeout"
>> value="${jdbc.removeAbandonedTimeout}"/>
>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>> </bean>
>>
>> </blueprint>
>>
>> Regards,
>>
>> Charles
>>
>>
>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>> Halo Charles,
>>>
>>> I think that you didn't paste the actual data source.
>>>
>>>
>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>> when I try to insert data in the DB, openJPA generates the following
>>>> error :
>>>>
>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at
>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>
>>>>
>>>> The property
>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>> osgi service
>>>>
>>>> Persistence
>>>> **************
>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>
>>>>
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>
>>>>
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>
>>>>
>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>> <!-- Required by openJPA to update sequence table outside of
>>>> Global Tx Management -->
>>>>
>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>
>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>
>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>
>>>> <!-- openjpa & HSQLDB -->
>>>> <properties>
>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>
>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>> <property name="openjpa.Log"
>>>> value="commons"/>
>>>> <property name="openjpa.jdbc.DBDictionary"
>>>> value="hsql(useSchemaName=true)"/>
>>>> <property name="openjpa.jdbc.Schema"
>>>> value="PUBLIC"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <property name="openjpa.ManagedRuntime"
>>>>
>>>>
>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>> <property name="openjpa.Multithreaded"
>>>> value="true"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>> value="managed"/>-->
>>>> </properties>
>>>>
>>>>
>>>>
>>>> Blueprint config of the DataSource
>>>> ****************************************
>>>> <service auto-export="interfaces" ref="jta">
>>>> <service-properties>
>>>> <entry key="transactional" value="true"/>
>>>> </service-properties>
>>>> </service>
>>>>
>>>> <service auto-export="interfaces" ref="jta">
>>>> <service-properties>
>>>> <entry key="transactional" value="true"/>
>>>> </service-properties>
>>>> </service>
>>>>
>>>> Any idea is welcome.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>>
>>>> Sr. Principal Solution Architect - FuseSource
>>>> Apache Committer
>>>>
>>>> Blog : http://cmoulliard.blogspot.com
>>>> Twitter : http://twitter.com/cmoulliard
>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>> Skype: cmoulliard
>>>>
>>>
>>>
>>>
>>> --
>>> *Ioannis Canellos*
>>> *
>>> http://iocanel.blogspot.com
>>>
>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>> *
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Hi Guillaume,
The interfaces of the DataSource and XADatasource are well exposed
karaf@root> ls 249
FuseSource :: Webinars :: Fuse ESB & Persistence :: Database (249) provides:
----------------------------------------------------------------------------
objectClass = javax.sql.XADataSource
osgi.service.blueprint.compname = jta
service.id = 171
transactional = true
----
objectClass = javax.sql.DataSource
osgi.service.blueprint.compname = nonJTA
service.id = 172
transactional = false
----
objectClass = org.osgi.service.blueprint.container.BlueprintContainer
osgi.blueprint.container.symbolicname = database
osgi.blueprint.container.version = 1.0.0
service.id = 173
and aries jndi is deployed
karaf@root> list | grep -i jndi
[ 144] [Active ] [ ] [ ] [ 60] Apache Aries
JNDI API (0.2.0.incubating)
[ 145] [Active ] [ ] [ ] [ 60] Apache Aries
JNDI Core (0.2.0.incubating)
[ 146] [Active ] [ ] [ ] [ 60] Apache Aries
JNDI URL Handler (0.2.0.incubating)
BTW, I have made a small modification in the spring definition and now
openJPA is not able to cast a XADataSource !!
Persistence config
**********************
<persistence-unit name="reportincident" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.XADataSource/(transactional=true)</jta-data-source>
<!-- Required by openJPA to update sequence table outside of
Global Tx Management -->
<non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
<class>com.fusesource.webinars.persistence.model.Incident</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<!-- openjpa & HSQLDB -->
<properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(SchemaAction='add,deleteTableContents')"/>
<property name="openjpa.Log"
value="commons"/>
<property name="openjpa.jdbc.DBDictionary"
value="hsql(useSchemaName=true)"/>
<property name="openjpa.jdbc.Schema"
value="PUBLIC"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<property name="openjpa.ManagedRuntime"
value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
<property name="openjpa.Multithreaded"
value="true"/>
<property name="openjpa.TransactionMode"
value="managed"/>
<property name="openjpa.ConnectionFactoryMode"
value="managed"/>
</properties>
</persistence-unit>
</persistence>
Spring config
***************
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="reportincident"/>
</bean>
Regards,
Charles
On Tue, Apr 12, 2011 at 3:43 PM, Guillaume Nodet <gn...@gmail.com> wrote:
> Looking at the stack trace, the problem seems to be in the JPA
> definition, as it does not hit the datasource.
> Can you list the services exported by the datasource bundle ?
> Also, do you have aries jndi installed ? As your config uses it to
> lookup the osgi service.
>
> On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
>> Here is the complete blueprint file to expose the datasource
>>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>>
>> <cm:property-placeholder persistent-id="database" id="database">
>> <cm:default-properties>
>>
>> <!-- JDBC Drivers -->
>> <cm:property name="jdbc.driverClassName"
>> value="org.hsqldb.jdbcDriver"/>
>> <cm:property name="jdbc.url"
>> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
>> <cm:property name="jdbc.username" value="sa"/>
>> <cm:property name="jdbc.password" value=""/>
>>
>> <!-- Connection Pooling DBCP -->
>> <cm:property name="jdbc.initialSize" value="5"/>
>> <cm:property name="jdbc.maxActive" value="10"/>
>> <cm:property name="jdbc.maxIdle" value="10"/>
>> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
>> <cm:property name="jdbc.removeAbandoned" value="false"/>
>> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
>> <cm:property name="jdbc.logAbandoned" value="false"/>
>>
>> </cm:default-properties>
>> </cm:property-placeholder>
>>
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> <service auto-export="interfaces" ref="nonJTA">
>> <service-properties>
>> <entry key="transactional" value="false"/>
>> </service-properties>
>> </service>
>>
>> <!-- ###### JDBC Data Source ###### -->
>> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
>> <property name="driverName" value="${jdbc.driverClassName}"/>
>> <property name="url" value="${jdbc.url}"/>
>> <property name="user" value="${jdbc.username}"/>
>> <property name="password" value="${jdbc.password}"/>
>> </bean>
>>
>> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
>> <property name="driverClassName" value="${jdbc.driverClassName}"/>
>> <property name="url" value="${jdbc.url}"/>
>> <property name="username" value="${jdbc.username}"/>
>> <property name="password" value="${jdbc.password}"/>
>> <property name="initialSize" value="${jdbc.initialSize}"/>
>> <property name="maxActive" value="${jdbc.maxActive}"/>
>> <property name="maxIdle" value="${jdbc.maxIdle}"/>
>> <property name="defaultAutoCommit" value="false"/>
>> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
>> <property name="removeAbandonedTimeout"
>> value="${jdbc.removeAbandonedTimeout}"/>
>> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
>> </bean>
>>
>> </blueprint>
>>
>> Regards,
>>
>> Charles
>>
>>
>> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>>> Halo Charles,
>>>
>>> I think that you didn't paste the actual data source.
>>>
>>>
>>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>>> when I try to insert data in the DB, openJPA generates the following
>>>> error :
>>>>
>>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at
>>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>>
>>>>
>>>> The property
>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>>> in the persistence.xml file point to the XADataSource exposed as an
>>>> osgi service
>>>>
>>>> Persistence
>>>> **************
>>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>>
>>>>
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>
>>>>
>>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>>
>>>>
>>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>>> <!-- Required by openJPA to update sequence table outside of
>>>> Global Tx Management -->
>>>>
>>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>>
>>>> <class>com.mycompany.persistence.model.Incident</class>
>>>>
>>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>>
>>>> <!-- openjpa & HSQLDB -->
>>>> <properties>
>>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>>
>>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>>> <property name="openjpa.Log"
>>>> value="commons"/>
>>>> <property name="openjpa.jdbc.DBDictionary"
>>>> value="hsql(useSchemaName=true)"/>
>>>> <property name="openjpa.jdbc.Schema"
>>>> value="PUBLIC"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <property name="openjpa.ManagedRuntime"
>>>>
>>>>
>>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>>> <property name="openjpa.Multithreaded"
>>>> value="true"/>
>>>> <property name="openjpa.TransactionMode"
>>>> value="managed"/>
>>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>>> value="managed"/>-->
>>>> </properties>
>>>>
>>>>
>>>>
>>>> Blueprint config of the DataSource
>>>> ****************************************
>>>> <service auto-export="interfaces" ref="jta">
>>>> <service-properties>
>>>> <entry key="transactional" value="true"/>
>>>> </service-properties>
>>>> </service>
>>>>
>>>> <service auto-export="interfaces" ref="jta">
>>>> <service-properties>
>>>> <entry key="transactional" value="true"/>
>>>> </service-properties>
>>>> </service>
>>>>
>>>> Any idea is welcome.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>>
>>>> Sr. Principal Solution Architect - FuseSource
>>>> Apache Committer
>>>>
>>>> Blog : http://cmoulliard.blogspot.com
>>>> Twitter : http://twitter.com/cmoulliard
>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>> Skype: cmoulliard
>>>>
>>>
>>>
>>>
>>> --
>>> *Ioannis Canellos*
>>> *
>>> http://iocanel.blogspot.com
>>>
>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>>> *
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Guillaume Nodet <gn...@gmail.com>.
Looking at the stack trace, the problem seems to be in the JPA
definition, as it does not hit the datasource.
Can you list the services exported by the datasource bundle ?
Also, do you have aries jndi installed ? As your config uses it to
lookup the osgi service.
On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
> Here is the complete blueprint file to expose the datasource
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>
> <cm:property-placeholder persistent-id="database" id="database">
> <cm:default-properties>
>
> <!-- JDBC Drivers -->
> <cm:property name="jdbc.driverClassName"
> value="org.hsqldb.jdbcDriver"/>
> <cm:property name="jdbc.url"
> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
> <cm:property name="jdbc.username" value="sa"/>
> <cm:property name="jdbc.password" value=""/>
>
> <!-- Connection Pooling DBCP -->
> <cm:property name="jdbc.initialSize" value="5"/>
> <cm:property name="jdbc.maxActive" value="10"/>
> <cm:property name="jdbc.maxIdle" value="10"/>
> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
> <cm:property name="jdbc.removeAbandoned" value="false"/>
> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
> <cm:property name="jdbc.logAbandoned" value="false"/>
>
> </cm:default-properties>
> </cm:property-placeholder>
>
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> <service auto-export="interfaces" ref="nonJTA">
> <service-properties>
> <entry key="transactional" value="false"/>
> </service-properties>
> </service>
>
> <!-- ###### JDBC Data Source ###### -->
> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
> <property name="driverName" value="${jdbc.driverClassName}"/>
> <property name="url" value="${jdbc.url}"/>
> <property name="user" value="${jdbc.username}"/>
> <property name="password" value="${jdbc.password}"/>
> </bean>
>
> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
> <property name="driverClassName" value="${jdbc.driverClassName}"/>
> <property name="url" value="${jdbc.url}"/>
> <property name="username" value="${jdbc.username}"/>
> <property name="password" value="${jdbc.password}"/>
> <property name="initialSize" value="${jdbc.initialSize}"/>
> <property name="maxActive" value="${jdbc.maxActive}"/>
> <property name="maxIdle" value="${jdbc.maxIdle}"/>
> <property name="defaultAutoCommit" value="false"/>
> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
> <property name="removeAbandonedTimeout"
> value="${jdbc.removeAbandonedTimeout}"/>
> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
> </bean>
>
> </blueprint>
>
> Regards,
>
> Charles
>
>
> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>> Halo Charles,
>>
>> I think that you didn't paste the actual data source.
>>
>>
>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>> when I try to insert data in the DB, openJPA generates the following
>>> error :
>>>
>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>
>>>
>>> The property
>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>> in the persistence.xml file point to the XADataSource exposed as an
>>> osgi service
>>>
>>> Persistence
>>> **************
>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>
>>>
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>
>>>
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>
>>>
>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>> <!-- Required by openJPA to update sequence table outside of
>>> Global Tx Management -->
>>>
>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>
>>> <class>com.mycompany.persistence.model.Incident</class>
>>>
>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>
>>> <!-- openjpa & HSQLDB -->
>>> <properties>
>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>
>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>> <property name="openjpa.Log"
>>> value="commons"/>
>>> <property name="openjpa.jdbc.DBDictionary"
>>> value="hsql(useSchemaName=true)"/>
>>> <property name="openjpa.jdbc.Schema"
>>> value="PUBLIC"/>
>>> <property name="openjpa.TransactionMode"
>>> value="managed"/>
>>> <property name="openjpa.ManagedRuntime"
>>>
>>>
>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>> <property name="openjpa.Multithreaded"
>>> value="true"/>
>>> <property name="openjpa.TransactionMode"
>>> value="managed"/>
>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>> value="managed"/>-->
>>> </properties>
>>>
>>>
>>>
>>> Blueprint config of the DataSource
>>> ****************************************
>>> <service auto-export="interfaces" ref="jta">
>>> <service-properties>
>>> <entry key="transactional" value="true"/>
>>> </service-properties>
>>> </service>
>>>
>>> <service auto-export="interfaces" ref="jta">
>>> <service-properties>
>>> <entry key="transactional" value="true"/>
>>> </service-properties>
>>> </service>
>>>
>>> Any idea is welcome.
>>>
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Sr. Principal Solution Architect - FuseSource
>>> Apache Committer
>>>
>>> Blog : http://cmoulliard.blogspot.com
>>> Twitter : http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>> Skype: cmoulliard
>>>
>>
>>
>>
>> --
>> *Ioannis Canellos*
>> *
>> http://iocanel.blogspot.com
>>
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>> *
>>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Guillaume Nodet <gn...@gmail.com>.
Looking at the stack trace, the problem seems to be in the JPA
definition, as it does not hit the datasource.
Can you list the services exported by the datasource bundle ?
Also, do you have aries jndi installed ? As your config uses it to
lookup the osgi service.
On Tue, Apr 12, 2011 at 14:47, Charles Moulliard <cm...@gmail.com> wrote:
> Here is the complete blueprint file to expose the datasource
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
>
> <cm:property-placeholder persistent-id="database" id="database">
> <cm:default-properties>
>
> <!-- JDBC Drivers -->
> <cm:property name="jdbc.driverClassName"
> value="org.hsqldb.jdbcDriver"/>
> <cm:property name="jdbc.url"
> value="jdbc:hsqldb:hsql://localhost/reportdb"/>
> <cm:property name="jdbc.username" value="sa"/>
> <cm:property name="jdbc.password" value=""/>
>
> <!-- Connection Pooling DBCP -->
> <cm:property name="jdbc.initialSize" value="5"/>
> <cm:property name="jdbc.maxActive" value="10"/>
> <cm:property name="jdbc.maxIdle" value="10"/>
> <cm:property name="jdbc.defaultAutoCommit" value="false"/>
> <cm:property name="jdbc.removeAbandoned" value="false"/>
> <cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
> <cm:property name="jdbc.logAbandoned" value="false"/>
>
> </cm:default-properties>
> </cm:property-placeholder>
>
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> <service auto-export="interfaces" ref="nonJTA">
> <service-properties>
> <entry key="transactional" value="false"/>
> </service-properties>
> </service>
>
> <!-- ###### JDBC Data Source ###### -->
> <bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
> <property name="driverName" value="${jdbc.driverClassName}"/>
> <property name="url" value="${jdbc.url}"/>
> <property name="user" value="${jdbc.username}"/>
> <property name="password" value="${jdbc.password}"/>
> </bean>
>
> <bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
> <property name="driverClassName" value="${jdbc.driverClassName}"/>
> <property name="url" value="${jdbc.url}"/>
> <property name="username" value="${jdbc.username}"/>
> <property name="password" value="${jdbc.password}"/>
> <property name="initialSize" value="${jdbc.initialSize}"/>
> <property name="maxActive" value="${jdbc.maxActive}"/>
> <property name="maxIdle" value="${jdbc.maxIdle}"/>
> <property name="defaultAutoCommit" value="false"/>
> <property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
> <property name="removeAbandonedTimeout"
> value="${jdbc.removeAbandonedTimeout}"/>
> <property name="logAbandoned" value="${jdbc.logAbandoned}"/>
> </bean>
>
> </blueprint>
>
> Regards,
>
> Charles
>
>
> On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
>> Halo Charles,
>>
>> I think that you didn't paste the actual data source.
>>
>>
>> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>>> when I try to insert data in the DB, openJPA generates the following
>>> error :
>>>
>>> Caused by: java.lang.RuntimeException: There were errors initializing
>>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>>
>>>
>>> The property
>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>>> in the persistence.xml file point to the XADataSource exposed as an
>>> osgi service
>>>
>>> Persistence
>>> **************
>>> <persistence-unit name="reportincident" transaction-type="JTA">
>>>
>>>
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>
>>>
>>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>>
>>>
>>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>>> <!-- Required by openJPA to update sequence table outside of
>>> Global Tx Management -->
>>>
>>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>>
>>> <class>com.mycompany.persistence.model.Incident</class>
>>>
>>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>>
>>> <!-- openjpa & HSQLDB -->
>>> <properties>
>>> <property name="openjpa.jdbc.SynchronizeMappings"
>>>
>>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>>> <property name="openjpa.Log"
>>> value="commons"/>
>>> <property name="openjpa.jdbc.DBDictionary"
>>> value="hsql(useSchemaName=true)"/>
>>> <property name="openjpa.jdbc.Schema"
>>> value="PUBLIC"/>
>>> <property name="openjpa.TransactionMode"
>>> value="managed"/>
>>> <property name="openjpa.ManagedRuntime"
>>>
>>>
>>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>>> <property name="openjpa.Multithreaded"
>>> value="true"/>
>>> <property name="openjpa.TransactionMode"
>>> value="managed"/>
>>> <!--<property name="openjpa.ConnectionFactoryMode"
>>> value="managed"/>-->
>>> </properties>
>>>
>>>
>>>
>>> Blueprint config of the DataSource
>>> ****************************************
>>> <service auto-export="interfaces" ref="jta">
>>> <service-properties>
>>> <entry key="transactional" value="true"/>
>>> </service-properties>
>>> </service>
>>>
>>> <service auto-export="interfaces" ref="jta">
>>> <service-properties>
>>> <entry key="transactional" value="true"/>
>>> </service-properties>
>>> </service>
>>>
>>> Any idea is welcome.
>>>
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Sr. Principal Solution Architect - FuseSource
>>> Apache Committer
>>>
>>> Blog : http://cmoulliard.blogspot.com
>>> Twitter : http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>> Skype: cmoulliard
>>>
>>
>>
>>
>> --
>> *Ioannis Canellos*
>> *
>> http://iocanel.blogspot.com
>>
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> Apache ServiceMix <http://servicemix.apache.org/> Committer
>> *
>>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Here is the complete blueprint file to expose the datasource
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
<cm:property-placeholder persistent-id="database" id="database">
<cm:default-properties>
<!-- JDBC Drivers -->
<cm:property name="jdbc.driverClassName"
value="org.hsqldb.jdbcDriver"/>
<cm:property name="jdbc.url"
value="jdbc:hsqldb:hsql://localhost/reportdb"/>
<cm:property name="jdbc.username" value="sa"/>
<cm:property name="jdbc.password" value=""/>
<!-- Connection Pooling DBCP -->
<cm:property name="jdbc.initialSize" value="5"/>
<cm:property name="jdbc.maxActive" value="10"/>
<cm:property name="jdbc.maxIdle" value="10"/>
<cm:property name="jdbc.defaultAutoCommit" value="false"/>
<cm:property name="jdbc.removeAbandoned" value="false"/>
<cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
<cm:property name="jdbc.logAbandoned" value="false"/>
</cm:default-properties>
</cm:property-placeholder>
<service auto-export="interfaces" ref="jta">
<service-properties>
<entry key="transactional" value="true"/>
</service-properties>
</service>
<service auto-export="interfaces" ref="nonJTA">
<service-properties>
<entry key="transactional" value="false"/>
</service-properties>
</service>
<!-- ###### JDBC Data Source ###### -->
<bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
<property name="driverName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="maxActive" value="${jdbc.maxActive}"/>
<property name="maxIdle" value="${jdbc.maxIdle}"/>
<property name="defaultAutoCommit" value="false"/>
<property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
<property name="removeAbandonedTimeout"
value="${jdbc.removeAbandonedTimeout}"/>
<property name="logAbandoned" value="${jdbc.logAbandoned}"/>
</bean>
</blueprint>
Regards,
Charles
On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
> Halo Charles,
>
> I think that you didn't paste the actual data source.
>
>
> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>
>> Hi,
>>
>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>> when I try to insert data in the DB, openJPA generates the following
>> error :
>>
>> Caused by: java.lang.RuntimeException: There were errors initializing
>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>
>>
>> The property
>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>> in the persistence.xml file point to the XADataSource exposed as an
>> osgi service
>>
>> Persistence
>> **************
>> <persistence-unit name="reportincident" transaction-type="JTA">
>>
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>>
>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>> <!-- Required by openJPA to update sequence table outside of
>> Global Tx Management -->
>>
>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>
>> <class>com.mycompany.persistence.model.Incident</class>
>>
>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>
>> <!-- openjpa & HSQLDB -->
>> <properties>
>> <property name="openjpa.jdbc.SynchronizeMappings"
>>
>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>> <property name="openjpa.Log"
>> value="commons"/>
>> <property name="openjpa.jdbc.DBDictionary"
>> value="hsql(useSchemaName=true)"/>
>> <property name="openjpa.jdbc.Schema"
>> value="PUBLIC"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ManagedRuntime"
>>
>>
>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>> <property name="openjpa.Multithreaded"
>> value="true"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <!--<property name="openjpa.ConnectionFactoryMode"
>> value="managed"/>-->
>> </properties>
>>
>>
>>
>> Blueprint config of the DataSource
>> ****************************************
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> Any idea is welcome.
>>
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Sr. Principal Solution Architect - FuseSource
>> Apache Committer
>>
>> Blog : http://cmoulliard.blogspot.com
>> Twitter : http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> Skype: cmoulliard
>>
>
>
>
> --
> *Ioannis Canellos*
> *
> http://iocanel.blogspot.com
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> Apache ServiceMix <http://servicemix.apache.org/> Committer
> *
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
Here is the complete blueprint file to expose the datasource
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
<cm:property-placeholder persistent-id="database" id="database">
<cm:default-properties>
<!-- JDBC Drivers -->
<cm:property name="jdbc.driverClassName"
value="org.hsqldb.jdbcDriver"/>
<cm:property name="jdbc.url"
value="jdbc:hsqldb:hsql://localhost/reportdb"/>
<cm:property name="jdbc.username" value="sa"/>
<cm:property name="jdbc.password" value=""/>
<!-- Connection Pooling DBCP -->
<cm:property name="jdbc.initialSize" value="5"/>
<cm:property name="jdbc.maxActive" value="10"/>
<cm:property name="jdbc.maxIdle" value="10"/>
<cm:property name="jdbc.defaultAutoCommit" value="false"/>
<cm:property name="jdbc.removeAbandoned" value="false"/>
<cm:property name="jdbc.removeAbandonedTimeout" value="300"/>
<cm:property name="jdbc.logAbandoned" value="false"/>
</cm:default-properties>
</cm:property-placeholder>
<service auto-export="interfaces" ref="jta">
<service-properties>
<entry key="transactional" value="true"/>
</service-properties>
</service>
<service auto-export="interfaces" ref="nonJTA">
<service-properties>
<entry key="transactional" value="false"/>
</service-properties>
</service>
<!-- ###### JDBC Data Source ###### -->
<bean id="jta" class="org.enhydra.jdbc.standard.StandardXADataSource">
<property name="driverName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<bean class="org.apache.commons.dbcp.BasicDataSource" id="nonJTA">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="maxActive" value="${jdbc.maxActive}"/>
<property name="maxIdle" value="${jdbc.maxIdle}"/>
<property name="defaultAutoCommit" value="false"/>
<property name="removeAbandoned" value="${jdbc.removeAbandoned}"/>
<property name="removeAbandonedTimeout"
value="${jdbc.removeAbandonedTimeout}"/>
<property name="logAbandoned" value="${jdbc.logAbandoned}"/>
</bean>
</blueprint>
Regards,
Charles
On Tue, Apr 12, 2011 at 2:37 PM, Ioannis Canellos <io...@gmail.com> wrote:
> Halo Charles,
>
> I think that you didn't paste the actual data source.
>
>
> On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
>
>> Hi,
>>
>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>> when I try to insert data in the DB, openJPA generates the following
>> error :
>>
>> Caused by: java.lang.RuntimeException: There were errors initializing
>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>
>>
>> The property
>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>> in the persistence.xml file point to the XADataSource exposed as an
>> osgi service
>>
>> Persistence
>> **************
>> <persistence-unit name="reportincident" transaction-type="JTA">
>>
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>>
>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>> <!-- Required by openJPA to update sequence table outside of
>> Global Tx Management -->
>>
>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>
>> <class>com.mycompany.persistence.model.Incident</class>
>>
>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>
>> <!-- openjpa & HSQLDB -->
>> <properties>
>> <property name="openjpa.jdbc.SynchronizeMappings"
>>
>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>> <property name="openjpa.Log"
>> value="commons"/>
>> <property name="openjpa.jdbc.DBDictionary"
>> value="hsql(useSchemaName=true)"/>
>> <property name="openjpa.jdbc.Schema"
>> value="PUBLIC"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ManagedRuntime"
>>
>>
>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>> <property name="openjpa.Multithreaded"
>> value="true"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <!--<property name="openjpa.ConnectionFactoryMode"
>> value="managed"/>-->
>> </properties>
>>
>>
>>
>> Blueprint config of the DataSource
>> ****************************************
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> Any idea is welcome.
>>
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Sr. Principal Solution Architect - FuseSource
>> Apache Committer
>>
>> Blog : http://cmoulliard.blogspot.com
>> Twitter : http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> Skype: cmoulliard
>>
>
>
>
> --
> *Ioannis Canellos*
> *
> http://iocanel.blogspot.com
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> Apache ServiceMix <http://servicemix.apache.org/> Committer
> *
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Ioannis Canellos <io...@gmail.com>.
Halo Charles,
I think that you didn't paste the actual data source.
On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
> Hi,
>
> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
> when I try to insert data in the DB, openJPA generates the following
> error :
>
> Caused by: java.lang.RuntimeException: There were errors initializing
> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>
>
> The property
> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
> in the persistence.xml file point to the XADataSource exposed as an
> osgi service
>
> Persistence
> **************
> <persistence-unit name="reportincident" transaction-type="JTA">
>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>
> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
> <!-- Required by openJPA to update sequence table outside of
> Global Tx Management -->
>
> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>
> <class>com.mycompany.persistence.model.Incident</class>
>
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
> <!-- openjpa & HSQLDB -->
> <properties>
> <property name="openjpa.jdbc.SynchronizeMappings"
>
> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
> <property name="openjpa.Log"
> value="commons"/>
> <property name="openjpa.jdbc.DBDictionary"
> value="hsql(useSchemaName=true)"/>
> <property name="openjpa.jdbc.Schema"
> value="PUBLIC"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <property name="openjpa.ManagedRuntime"
>
>
> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
> <property name="openjpa.Multithreaded"
> value="true"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <!--<property name="openjpa.ConnectionFactoryMode"
> value="managed"/>-->
> </properties>
>
>
>
> Blueprint config of the DataSource
> ****************************************
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> Any idea is welcome.
>
>
> Regards,
>
> Charles Moulliard
>
> Sr. Principal Solution Architect - FuseSource
> Apache Committer
>
> Blog : http://cmoulliard.blogspot.com
> Twitter : http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard
> Skype: cmoulliard
>
--
*Ioannis Canellos*
*
http://iocanel.blogspot.com
Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache ServiceMix <http://servicemix.apache.org/> Committer
*
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
For sure that hsqldb is installed -->
[ 125] [Active ] [ ] [ ] [ 60]
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.hsqldb/1.8.0.10_1
I have also added DynamicImport-Package : * into the bundle of openjpa
On Tue, Apr 12, 2011 at 2:30 PM, Jamie G. <ja...@gmail.com> wrote:
> Have you installed the JDBC driver? The exception looks similar to
> when one starts a Master/Slave failover configuration of Karaf/SMX
> without the driver jar installed for the backend database.
>
> Cheers,
> Jamie
>
> On Tue, Apr 12, 2011 at 9:50 AM, Charles Moulliard <cm...@gmail.com> wrote:
>> Hi,
>>
>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>> when I try to insert data in the DB, openJPA generates the following
>> error :
>>
>> Caused by: java.lang.RuntimeException: There were errors initializing
>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>
>>
>> The property <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>> in the persistence.xml file point to the XADataSource exposed as an
>> osgi service
>>
>> Persistence
>> **************
>> <persistence-unit name="reportincident" transaction-type="JTA">
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>> <!-- Required by openJPA to update sequence table outside of
>> Global Tx Management -->
>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>
>> <class>com.mycompany.persistence.model.Incident</class>
>>
>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>
>> <!-- openjpa & HSQLDB -->
>> <properties>
>> <property name="openjpa.jdbc.SynchronizeMappings"
>>
>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>> <property name="openjpa.Log"
>> value="commons"/>
>> <property name="openjpa.jdbc.DBDictionary"
>> value="hsql(useSchemaName=true)"/>
>> <property name="openjpa.jdbc.Schema"
>> value="PUBLIC"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ManagedRuntime"
>>
>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>> <property name="openjpa.Multithreaded"
>> value="true"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <!--<property name="openjpa.ConnectionFactoryMode"
>> value="managed"/>-->
>> </properties>
>>
>>
>>
>> Blueprint config of the DataSource
>> ****************************************
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> Any idea is welcome.
>>
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Sr. Principal Solution Architect - FuseSource
>> Apache Committer
>>
>> Blog : http://cmoulliard.blogspot.com
>> Twitter : http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> Skype: cmoulliard
>>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Charles Moulliard <cm...@gmail.com>.
For sure that hsqldb is installed -->
[ 125] [Active ] [ ] [ ] [ 60]
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.hsqldb/1.8.0.10_1
I have also added DynamicImport-Package : * into the bundle of openjpa
On Tue, Apr 12, 2011 at 2:30 PM, Jamie G. <ja...@gmail.com> wrote:
> Have you installed the JDBC driver? The exception looks similar to
> when one starts a Master/Slave failover configuration of Karaf/SMX
> without the driver jar installed for the backend database.
>
> Cheers,
> Jamie
>
> On Tue, Apr 12, 2011 at 9:50 AM, Charles Moulliard <cm...@gmail.com> wrote:
>> Hi,
>>
>> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
>> when I try to insert data in the DB, openJPA generates the following
>> error :
>>
>> Caused by: java.lang.RuntimeException: There were errors initializing
>> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
>> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>>
>>
>> The property <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
>> in the persistence.xml file point to the XADataSource exposed as an
>> osgi service
>>
>> Persistence
>> **************
>> <persistence-unit name="reportincident" transaction-type="JTA">
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>
>> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
>> <!-- Required by openJPA to update sequence table outside of
>> Global Tx Management -->
>> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>>
>> <class>com.mycompany.persistence.model.Incident</class>
>>
>> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>>
>> <!-- openjpa & HSQLDB -->
>> <properties>
>> <property name="openjpa.jdbc.SynchronizeMappings"
>>
>> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>> <property name="openjpa.Log"
>> value="commons"/>
>> <property name="openjpa.jdbc.DBDictionary"
>> value="hsql(useSchemaName=true)"/>
>> <property name="openjpa.jdbc.Schema"
>> value="PUBLIC"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <property name="openjpa.ManagedRuntime"
>>
>> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
>> <property name="openjpa.Multithreaded"
>> value="true"/>
>> <property name="openjpa.TransactionMode"
>> value="managed"/>
>> <!--<property name="openjpa.ConnectionFactoryMode"
>> value="managed"/>-->
>> </properties>
>>
>>
>>
>> Blueprint config of the DataSource
>> ****************************************
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> <service auto-export="interfaces" ref="jta">
>> <service-properties>
>> <entry key="transactional" value="true"/>
>> </service-properties>
>> </service>
>>
>> Any idea is welcome.
>>
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Sr. Principal Solution Architect - FuseSource
>> Apache Committer
>>
>> Blog : http://cmoulliard.blogspot.com
>> Twitter : http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> Skype: cmoulliard
>>
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by "Jamie G." <ja...@gmail.com>.
Have you installed the JDBC driver? The exception looks similar to
when one starts a Master/Slave failover configuration of Karaf/SMX
without the driver jar installed for the backend database.
Cheers,
Jamie
On Tue, Apr 12, 2011 at 9:50 AM, Charles Moulliard <cm...@gmail.com> wrote:
> Hi,
>
> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
> when I try to insert data in the DB, openJPA generates the following
> error :
>
> Caused by: java.lang.RuntimeException: There were errors initializing
> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>
>
> The property <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
> in the persistence.xml file point to the XADataSource exposed as an
> osgi service
>
> Persistence
> **************
> <persistence-unit name="reportincident" transaction-type="JTA">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
> <!-- Required by openJPA to update sequence table outside of
> Global Tx Management -->
> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>
> <class>com.mycompany.persistence.model.Incident</class>
>
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
> <!-- openjpa & HSQLDB -->
> <properties>
> <property name="openjpa.jdbc.SynchronizeMappings"
>
> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
> <property name="openjpa.Log"
> value="commons"/>
> <property name="openjpa.jdbc.DBDictionary"
> value="hsql(useSchemaName=true)"/>
> <property name="openjpa.jdbc.Schema"
> value="PUBLIC"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <property name="openjpa.ManagedRuntime"
>
> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
> <property name="openjpa.Multithreaded"
> value="true"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <!--<property name="openjpa.ConnectionFactoryMode"
> value="managed"/>-->
> </properties>
>
>
>
> Blueprint config of the DataSource
> ****************************************
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> Any idea is welcome.
>
>
> Regards,
>
> Charles Moulliard
>
> Sr. Principal Solution Architect - FuseSource
> Apache Committer
>
> Blog : http://cmoulliard.blogspot.com
> Twitter : http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard
> Skype: cmoulliard
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by "Jamie G." <ja...@gmail.com>.
Have you installed the JDBC driver? The exception looks similar to
when one starts a Master/Slave failover configuration of Karaf/SMX
without the driver jar installed for the backend database.
Cheers,
Jamie
On Tue, Apr 12, 2011 at 9:50 AM, Charles Moulliard <cm...@gmail.com> wrote:
> Hi,
>
> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
> when I try to insert data in the DB, openJPA generates the following
> error :
>
> Caused by: java.lang.RuntimeException: There were errors initializing
> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>
>
> The property <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
> in the persistence.xml file point to the XADataSource exposed as an
> osgi service
>
> Persistence
> **************
> <persistence-unit name="reportincident" transaction-type="JTA">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
> <!-- Required by openJPA to update sequence table outside of
> Global Tx Management -->
> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>
> <class>com.mycompany.persistence.model.Incident</class>
>
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
> <!-- openjpa & HSQLDB -->
> <properties>
> <property name="openjpa.jdbc.SynchronizeMappings"
>
> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
> <property name="openjpa.Log"
> value="commons"/>
> <property name="openjpa.jdbc.DBDictionary"
> value="hsql(useSchemaName=true)"/>
> <property name="openjpa.jdbc.Schema"
> value="PUBLIC"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <property name="openjpa.ManagedRuntime"
>
> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
> <property name="openjpa.Multithreaded"
> value="true"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <!--<property name="openjpa.ConnectionFactoryMode"
> value="managed"/>-->
> </properties>
>
>
>
> Blueprint config of the DataSource
> ****************************************
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> Any idea is welcome.
>
>
> Regards,
>
> Charles Moulliard
>
> Sr. Principal Solution Architect - FuseSource
> Apache Committer
>
> Blog : http://cmoulliard.blogspot.com
> Twitter : http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard
> Skype: cmoulliard
>
Re: OpenJPA - JTA - org.apache.openjpa.util.UserException: A JDBC
Driver or DataSource class name must be specified in the ConnectionDriverName property
Posted by Ioannis Canellos <io...@gmail.com>.
Halo Charles,
I think that you didn't paste the actual data source.
On Tue, Apr 12, 2011 at 3:20 PM, Charles Moulliard <cm...@gmail.com>wrote:
> Hi,
>
> I have configured OpenJPA to use a JTA/XA Datasource on ServiceMix but
> when I try to insert data in the DB, openJPA generates the following
> error :
>
> Caused by: java.lang.RuntimeException: There were errors initializing
> your configuration: <openjpa-2.1.0-r422266:1071316 fatal user error>
> org.apache.openjpa.util.UserException: 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.getConnectionFactory(JDBCConfigurationImpl.java:732)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
>
>
> The property
> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-datasource>
> in the persistence.xml file point to the XADataSource exposed as an
> osgi service
>
> Persistence
> **************
> <persistence-unit name="reportincident" transaction-type="JTA">
>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>
> <jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
> <!-- Required by openJPA to update sequence table outside of
> Global Tx Management -->
>
> <non-jta-data-source>osgi:service/javax.sql.DataSource/(transactional=false)</non-jta-data-source>
>
> <class>com.mycompany.persistence.model.Incident</class>
>
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
> <!-- openjpa & HSQLDB -->
> <properties>
> <property name="openjpa.jdbc.SynchronizeMappings"
>
> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
> <property name="openjpa.Log"
> value="commons"/>
> <property name="openjpa.jdbc.DBDictionary"
> value="hsql(useSchemaName=true)"/>
> <property name="openjpa.jdbc.Schema"
> value="PUBLIC"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <property name="openjpa.ManagedRuntime"
>
>
> value="jndi(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
> <property name="openjpa.Multithreaded"
> value="true"/>
> <property name="openjpa.TransactionMode"
> value="managed"/>
> <!--<property name="openjpa.ConnectionFactoryMode"
> value="managed"/>-->
> </properties>
>
>
>
> Blueprint config of the DataSource
> ****************************************
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> <service auto-export="interfaces" ref="jta">
> <service-properties>
> <entry key="transactional" value="true"/>
> </service-properties>
> </service>
>
> Any idea is welcome.
>
>
> Regards,
>
> Charles Moulliard
>
> Sr. Principal Solution Architect - FuseSource
> Apache Committer
>
> Blog : http://cmoulliard.blogspot.com
> Twitter : http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard
> Skype: cmoulliard
>
--
*Ioannis Canellos*
*
http://iocanel.blogspot.com
Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache ServiceMix <http://servicemix.apache.org/> Committer
*