I'm trying to persist my workflow into an Oracle db, when I tried to create
the session
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
I have the exception bellow
Hibernate: select hibernate_sequence.nextval from dual
May 12, 2011 2:14:09 PM org.hibernate.util.JDBCExceptionReporter
logExceptions
WARNING: SQL Error: 0, SQLState: null
May 12, 2011 2:14:09 PM org.hibernate.util.JDBCExceptionReporter
logExceptions
SEVERE: error enlisting a JdbcConnectionHandle of a JdbcPooledConnection
from datasource jdbc/DBD02 in state ACCESSIBLE wrapping
oracle.jdbc.xa.client.OracleXAConnection@1de2b1 on
oracle.jdbc.driver.OracleConnection@dee38
java.lang.RuntimeException: Could not commit session
at
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:119)
at
org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
at
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
at com.sample.ProcessTest.main(ProcessTest.java:61)
Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.GenericJDBCException: could not get next sequence
value
at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)
at
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:107)
... 3 more
Caused by: org.hibernate.exception.GenericJDBCException: could not get next
sequence value
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:119)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)
at
org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
at
org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)
... 4 more
Caused by: java.sql.SQLException: error enlisting a JdbcConnectionHandle of
a JdbcPooledConnection from datasource jdbc/DBD02 in state ACCESSIBLE
wrapping oracle.jdbc.xa.client.OracleXAConnection@1de2b1 on
oracle.jdbc.driver.OracleConnection@dee38
at
bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:61)
at
bitronix.tm.resource.jdbc.JdbcConnectionHandle.prepareStatement(JdbcConnectionHandle.java:200)
at
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
at
org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:145)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
... 13 more
Caused by: bitronix.tm.internal.BitronixSystemException: cannot enlist an
XAResourceHolderState with uniqueName=jdbc/DBD02
XAResource=oracle.jdbc.xa.client.OracleXAResource@1790581 with XID a
Bitronix XID [3138342E35312E31362E3232300000012FE420DBC400000000 :
3138342E35312E31362E3232300000012FE420DC5100000002], error=XAER_PROTO
at
bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:83)
at
bitronix.tm.resource.common.TransactionContextHelper.enlist(TransactionContextHelper.java:267)
at
bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:49)
at
bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:59)
... 17 more
Caused by: javax.transaction.xa.XAException
at
oracle.jdbc.xa.OracleXAResource.disallowLocalTxnMode(OracleXAResource.java:1045)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:153)
at
bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:179)
at bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:89)
at
bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:76)
... 20 more
Here is my configuration :
the code :
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("ruleflow.rf"),
ResourceType.DRF);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse
knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
configureDataSource();
// create the entity manager factory and register it in the
environment
EntityManagerFactory emf = Persistence.createEntityManagerFactory(
"org.drools.persistence.jpa" );
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
env.set( EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager() );
// create a new knowledge session that uses JPA to store the runtime
state
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
public static void configureDataSource()
{
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/DBD02");
ds.setClassName("oracle.jdbc.xa.client.OracleXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "xxx");
ds.getDriverProperties().put("password", "xxx");
ds.getDriverProperties().put("URL",
"jdbc:oracle:thin:@gfxdevdb01.fr.world.xxx:1567:DBD02");
ds.init();
}
the persistence.xml
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<persistence
version="1.0"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.drools.persistence.jpa"
transaction-type="RESOURCE_LOCAL" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/DBD02</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.connection.driver_class"
value="oracle.jdbc.OracleDriver"/>
<property name="hibernate.connection.autocommit" value="true"
/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
orm.xml
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<named-query name="ProcessInstancesWaitingForEvent">
<query>
select
processInstanceInfo.processInstanceId
from
ProcessInstanceInfo processInstanceInfo
where
:type in elements(processInstanceInfo.eventTypes)
</query>
</named-query>
</entity-mappings>
Do you have any idea about this problem ?
Thanks,
Regards,
--
View this message in context:
http://drools.46999.n3.nabble.com/Drools-flow-persistence-with-Oracle-err...
Sent from the Drools: User forum mailing list archive at
Nabble.com.