<br><font size=2 face="sans-serif">Robert,</font>
<br>
<br><font size=2 face="sans-serif">Try this:</font>
<br>
<ul>
<li><font size=2 face="sans-serif">create a directory called META-INF in
your classpath</font>
<li><font size=2 face="sans-serif">in that directory, add a file called
jndi.properties</font>
<li><font size=2 face="sans-serif">in that file, add the line: java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory</font></ul>
<br><font size=2 face="sans-serif">Does that fix things?<br>
</font>
<br><font size=2 face="sans-serif">Alan</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Robert <robert.weissmann@web.de></b>
</font>
<br><font size=1 face="sans-serif">Sent by: rules-users-bounces@lists.jboss.org</font>
<p><font size=1 face="sans-serif">08/06/2010 13:22</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Rules Users List <rules-users@lists.jboss.org></font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">"Rules Users List" <rules-users@lists.jboss.org>,
"Mark Proctor" <mproctor@codehaus.org>, "PAYET, Manuel"
<manuel.payet@capgemini.com></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [rules-users] Exception using persistence</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>I did, but I get the same Exception as before, but
on this new line<br>
<br>
<br>
UserTransaction ut = (UserTransaction) new <br>
InitialContext().lookup("java:comp/UserTransaction" );<br>
<br>
<br>
08.06.2010 14:10:58 org.eclipse.jetty.util.log.Slf4jLog info<br>
INFO: Logging to <br>
org.slf4j.impl.JDK14LoggerAdapter(org.eclipse.jetty.util.log) via <br>
org.eclipse.jetty.util.log.Slf4jLog<br>
Exception in thread "main" javax.naming.NameNotFoundException;
remaining <br>
name 'UserTransaction'<br>
at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576)<br>
at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663)<br>
at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678)<br>
at <br>
org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110)<br>
at javax.naming.InitialContext.lookup(InitialContext.java:392)<br>
at com.rob.tests.AnyTest$.test2(AnyTest.scala:38)<br>
at com.rob.tests.AnyTest$.main(AnyTest.scala:18)<br>
at com.rob.tests.AnyTest.main(AnyTest.scala)<br>
<br>
<br>
I still don't understand where the "java:comp/UserTransaction"
will be <br>
accessible/come-from/being-created ... ?<br>
<br>
<br>
Am 08.06.2010, 13:42 Uhr, schrieb PAYET, Manuel <br>
<manuel.payet@capgemini.com>:<br>
<br>
> I've made the same mistake at the beginning:<br>
><br>
><br>
> You'd probably want to replace:<br>
><br>
><br>
> val emf : EntityManagerFactory =<br>
> Persistence.createEntityManagerFactory( "org.drools.persistence.jpa"
)<br>
> val env : Environment = KnowledgeBaseFactory.newEnvironment()<br>
> env.set( EnvironmentName.ENTITY_MANAGER_FACTORY,
emf )<br>
><br>
> val ksession : StatefulKnowledgeSession = <br>
> JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env
)<br>
> val sessionId = ksession.getId<br>
><br>
> ksession.startProcess( "Process4" )<br>
> ksession.dispose();<br>
><br>
> By:<br>
><br>
> UserTransaction ut =<br>
> (UserTransaction) new InitialContext().lookup( <br>
> "java:comp/UserTransaction" );<br>
> ut.begin();<br>
><br>
><br>
> val emf : EntityManagerFactory =<br>
> Persistence.createEntityManagerFactory( "org.drools.persistence.jpa"
)<br>
> val env : Environment = KnowledgeBaseFactory.newEnvironment()<br>
> env.set( EnvironmentName.ENTITY_MANAGER_FACTORY,
emf )<br>
><br>
> val ksession : StatefulKnowledgeSession = <br>
> JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env
)<br>
> val sessionId = ksession.getId<br>
><br>
> ksession.startProcess( "Process4" )<br>
> ksession.dispose();<br>
><br>
> Ut.commit();<br>
><br>
><br>
> (you didn't open a transaction before ;))<br>
><br>
><br>
> -----Message d'origine-----<br>
> De : robert.weissmann@web.de [mailto:robert.weissmann@web.de]<br>
> Envoyé : mardi 8 juin 2010 13:42<br>
> À : Rules Users List; Mark Proctor; PAYET, Manuel<br>
> Objet : Re: [rules-users] Exception using persistence<br>
><br>
> Ok, let me start from what the drools doc descripes at<br>
><br>
> http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-flow/html_single/index.html#d0e1458<br>
><br>
> Here is my code<br>
><br>
><br>
> val kbuilder: KnowledgeBuilder =<br>
> KnowledgeBuilderFactory.newKnowledgeBuilder<br>
> kbuilder.add(ResourceFactory.newClassPathResource("processes/process4.rf"),<br>
> ResourceType.DRF);<br>
><br>
> val kbase: KnowledgeBase = kbuilder.newKnowledgeBase<br>
><br>
> val ds : PoolingDataSource = new PoolingDataSource()<br>
> ds.setUniqueName("jdbc/processInstanceDS")<br>
> ds.setClassName("org.h2.jdbcx.JdbcDataSource")<br>
> ds.setMaxPoolSize(3)<br>
> ds.setAllowLocalTransactions(true)<br>
> ds.getDriverProperties().put("user",
"sa")<br>
> ds.getDriverProperties().put("password",
"sasa")<br>
> ds.getDriverProperties().put("URL",<br>
> "jdbc:h2:file:/NotBackedUp/data/process-instance-db")<br>
> ds.init<br>
><br>
> val emf : EntityManagerFactory =<br>
> Persistence.createEntityManagerFactory( "org.drools.persistence.jpa"
)<br>
> val env : Environment = KnowledgeBaseFactory.newEnvironment()<br>
> env.set( EnvironmentName.ENTITY_MANAGER_FACTORY,
emf )<br>
><br>
> val ksession : StatefulKnowledgeSession = <br>
> JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env
)<br>
> val sessionId = ksession.getId<br>
><br>
> ksession.startProcess( "Process4" )<br>
> ksession.dispose();<br>
><br>
><br>
> and the persistence.xml:<br>
><br>
><br>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence<br>
> version="1.0"<br>
> xsi:schemaLocation=<br>
> "http://java.sun.com/xml/ns/persistence<br>
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd<br>
> http://java.sun.com/xml/ns/persistence/orm<br>
> http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"<br>
> xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"<br>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br>
> xmlns="http://java.sun.com/xml/ns/persistence"><br>
><br>
> <persistence-unit name="org.drools.persistence.jpa"><br>
> <provider>org.hibernate.ejb.HibernatePersistence</provider><br>
> <jta-data-source>jdbc/processInstanceDS</jta-data-source><br>
> <class>org.drools.persistence.session.SessionInfo</class><br>
> <class>org.drools.persistence.processinstance.ProcessInstanceInfo</class><br>
> <class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class><br>
> <class>org.drools.persistence.processinstance.WorkItemInfo</class><br>
><br>
> <properties><br>
> <property name="hibernate.dialect"<br>
> value="org.hibernate.dialect.H2Dialect"/><br>
> <property name="hibernate.max_fetch_depth"
value="3"/><br>
> <property name="hibernate.hbm2ddl.auto"
value="update"/><br>
> <property name="hibernate.show_sql"
value="true"/><br>
> <property name="hibernate.transaction.manager_lookup_class"<br>
> value="org.hibernate.transaction.BTMTransactionManagerLookup"/><br>
> </properties><br>
> </persistence-unit><br>
> </persistence><br>
><br>
><br>
> Thats pretty much whats in the drools doc.<br>
><br>
> But I get<br>
><br>
><br>
> 08.06.2010 13:31:52 org.hibernate.cfg.annotations.Version <clinit><br>
> INFO: Hibernate Annotations 3.4.0.GA<br>
> 08.06.2010 13:31:52 org.hibernate.cfg.Environment <clinit><br>
> INFO: Hibernate 3.3.0.SP1<br>
> 08.06.2010 13:31:52 org.hibernate.cfg.Environment <clinit><br>
> INFO: hibernate.properties not found<br>
> 08.06.2010 13:31:52 org.hibernate.cfg.Environment buildBytecodeProvider<br>
> INFO: Bytecode provider name : javassist 08.06.2010 13:31:52 <br>
> org.hibernate.cfg.Environment <clinit><br>
> INFO: using JDK 1.4 java.sql.Timestamp handling 08.06.2010 13:31:52
<br>
> org.hibernate.annotations.common.Version <clinit><br>
> INFO: Hibernate Commons Annotations 3.1.0.GA 08.06.2010 13:31:52 <br>
> org.hibernate.ejb.Version <clinit><br>
> INFO: Hibernate EntityManager 3.4.0.GA<br>
> 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder bindClass<br>
> INFO: Binding entity from annotated class:<br>
> org.drools.persistence.session.SessionInfo<br>
> 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable<br>
> INFO: Bind entity org.drools.persistence.session.SessionInfo on table
<br>
> SessionInfo 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder
<br>
> bindClass<br>
> INFO: Binding entity from annotated class:<br>
> org.drools.persistence.processinstance.ProcessInstanceInfo<br>
> 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable<br>
> INFO: Bind entity<br>
> org.drools.persistence.processinstance.ProcessInstanceInfo on table
<br>
> ProcessInstanceInfo 08.06.2010 13:31:53 <br>
> org.hibernate.cfg.AnnotationBinder bindClass<br>
> INFO: Binding entity from annotated class:<br>
> org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo<br>
> 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable<br>
> INFO: Bind entity<br>
> org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo<br>
> on table VariableInstanceInfo<br>
> 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder bindClass<br>
> INFO: Binding entity from annotated class:<br>
> org.drools.persistence.processinstance.WorkItemInfo<br>
> 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable<br>
> INFO: Bind entity org.drools.persistence.processinstance.WorkItemInfo
on <br>
> table WorkItemInfo 08.06.2010 13:31:54 <br>
> org.hibernate.cfg.annotations.CollectionBinder<br>
> bindOneToManySecondPass<br>
> INFO: Mapping collection:<br>
> org.drools.persistence.processinstance.ProcessInstanceInfo.variables
-> <br>
> VariableInstanceInfo 08.06.2010 13:31:54 <br>
> org.hibernate.cfg.AnnotationConfiguration<br>
> secondPassCompile<br>
> INFO: Hibernate Validator not found: ignoring 08.06.2010 13:31:54
<br>
> org.hibernate.cfg.search.HibernateSearchEventListenerRegister<br>
> enableHibernateSearch<br>
> INFO: Unable to find <br>
> org.hibernate.search.event.FullTextIndexEventListener<br>
> on the classpath. Hibernate Search is not enabled.<br>
> 08.06.2010 13:31:54 org.hibernate.util.NamingHelper getInitialContext<br>
> INFO: JNDI InitialContext properties:{}<br>
> 08.06.2010 13:31:54 org.hibernate.connection.DatasourceConnectionProvider<br>
> configure<br>
> INFO: Using datasource: jdbc/processInstanceDS 08.06.2010 13:31:56
<br>
> org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: RDBMS: H2, version: 1.0.77 (2008-08-16) 08.06.2010 13:31:56
<br>
> org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: JDBC driver: H2 JDBC Driver, version: 1.0.77 (2008-08-16) <br>
> 08.06.2010 13:31:56 org.hibernate.dialect.Dialect <init><br>
> INFO: Using dialect: org.hibernate.dialect.H2Dialect 08.06.2010 13:31:56
<br>
> org.hibernate.transaction.TransactionFactoryFactory<br>
> buildTransactionFactory<br>
> INFO: Transaction strategy:<br>
> org.hibernate.ejb.transaction.JoinableCMTTransactionFactory<br>
> 08.06.2010 13:31:56<br>
> org.hibernate.transaction.TransactionManagerLookupFactory<br>
> getTransactionManagerLookup<br>
> INFO: instantiating TransactionManagerLookup:<br>
> org.hibernate.transaction.BTMTransactionManagerLookup<br>
> 08.06.2010 13:31:56<br>
> org.hibernate.transaction.TransactionManagerLookupFactory<br>
> getTransactionManagerLookup<br>
> INFO: instantiated TransactionManagerLookup 08.06.2010 13:31:56 <br>
> org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Automatic flush during beforeCompletion(): disabled 08.06.2010
<br>
> 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Automatic session close at end of transaction: disabled 08.06.2010
<br>
> 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: JDBC batch size: 15<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: JDBC batch updates for versioned data: disabled 08.06.2010 <br>
> 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Scrollable result sets: enabled<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: JDBC3 getGeneratedKeys(): enabled<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Connection release mode: auto<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Maximum outer join fetch depth: 3<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Default batch fetch size: 1<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Generate SQL with comments: disabled 08.06.2010 13:31:56 <br>
> org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Order SQL updates by primary key: disabled 08.06.2010 13:31:56
<br>
> org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Order SQL inserts for batching: disabled 08.06.2010 13:31:56
<br>
> org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory<br>
> INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory<br>
> 08.06.2010 13:31:56 org.hibernate.hql.ast.ASTQueryTranslatorFactory
<br>
> <init><br>
> INFO: Using ASTQueryTranslatorFactory<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Query language substitutions: {}<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: JPA-QL strict compliance: enabled<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Second-level cache: enabled<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Query cache: disabled<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory createRegionFactory<br>
> INFO: Cache region factory :<br>
> org.hibernate.cache.impl.NoCachingRegionFactory<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Optimize cache for minimal puts: disabled 08.06.2010 13:31:56
<br>
> org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Structured second-level cache entries: disabled 08.06.2010 <br>
> 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Echoing all SQL to stdout<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Statistics: disabled<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Deleted entity synthetic identifier rollback: disabled 08.06.2010
<br>
> 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Default entity-mode: pojo<br>
> 08.06.2010 13:31:56 org.hibernate.cfg.SettingsFactory buildSettings<br>
> INFO: Named query checking : enabled<br>
> 08.06.2010 13:31:56 org.hibernate.impl.SessionFactoryImpl <init><br>
> INFO: building session factory<br>
> 08.06.2010 13:31:57 org.hibernate.impl.SessionFactoryObjectFactory<br>
> addInstance<br>
> INFO: Not binding factory to JNDI, no JNDI name configured 08.06.2010
<br>
> 13:31:57 org.hibernate.tool.hbm2ddl.SchemaUpdate execute<br>
> INFO: Running hbm2ddl schema update<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.SchemaUpdate execute<br>
> INFO: fetching database metadata<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.SchemaUpdate execute<br>
> INFO: updating schema<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: table found: PROCESS-INSTANCE-DB.PUBLIC.PROCESSINSTANCEINFO<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: columns: [externalvariables, startdate, lastreaddate, state,
<br>
> processinstancebytearray, optlock, processid, lastmodificationdate,
<br>
> processinstanceid] 08.06.2010 13:31:57 <br>
> org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: foreign keys: []<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: indexes: [primary_key_4]<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: table found:<br>
> PROCESS-INSTANCE-DB.PUBLIC.PROCESSINSTANCEINFO_EVENTTYPES<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: columns: [element, processinstanceinfo_processinstanceid]<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: foreign keys: [fk2fd59d8cbee4613c] 08.06.2010 13:31:57 <br>
> org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: indexes: [fk2fd59d8cbee4613c_index_b] 08.06.2010 13:31:57 <br>
> org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: table found: PROCESS-INSTANCE-DB.PUBLIC.SESSIONINFO<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: columns: [rulesbytearray, id, startdate, dirty, <br>
> lastmodificationdate] 08.06.2010 13:31:57 <br>
> org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: foreign keys: []<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: indexes: [primary_key_7]<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: table found: PROCESS-INSTANCE-DB.PUBLIC.VARIABLEINSTANCEINFO<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: columns: [id, persister, name, type, processid] 08.06.2010 <br>
> 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: foreign keys: [fk7be49b9f9123c534] 08.06.2010 13:31:57 <br>
> org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: indexes: [fk7be49b9f9123c534_index_2, primary_key_2] 08.06.2010
<br>
> 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: table found: PROCESS-INSTANCE-DB.PUBLIC.WORKITEMINFO<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: columns: [workitembytearray, name, workitemid, state, optlock,
<br>
> creationdate, processinstanceid] 08.06.2010 13:31:57 <br>
> org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: foreign keys: []<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.TableMetadata <init><br>
> INFO: indexes: [primary_key_b]<br>
> 08.06.2010 13:31:57 org.hibernate.tool.hbm2ddl.SchemaUpdate execute<br>
> INFO: schema update complete<br>
> 08.06.2010 13:31:57 bitronix.tm.BitronixTransactionManager logVersion<br>
> INFO: Bitronix Transaction Manager version 1.3.2 08.06.2010 13:31:57
<br>
> bitronix.tm.Configuration buildServerIdArray<br>
> WARNUNG: cannot get this JVM unique ID. Make sure it is configured
and <br>
> you only use ASCII characters. Will use IP address instead (unsafe
for <br>
> production usage!).<br>
> 08.06.2010 13:31:58 bitronix.tm.Configuration buildServerIdArray<br>
> INFO: JVM unique ID: <192.168.254.2><br>
> 08.06.2010 13:31:58 bitronix.tm.journal.DiskJournal open<br>
> WARNUNG: active log file is unclean, previous server crash ?<br>
> 08.06.2010 13:31:58 bitronix.tm.recovery.Recoverer run<br>
> INFO: recovery committed 0 dangling transaction(s) and rolled back
0 <br>
> aborted transaction(s) on 1 resource(s) [jdbc/processInstanceDS] <br>
> 08.06.2010 13:31:58 org.eclipse.jetty.util.log.Slf4jLog info<br>
> INFO: Logging to<br>
> org.slf4j.impl.JDK14LoggerAdapter(org.eclipse.jetty.util.log) via
<br>
> org.eclipse.jetty.util.log.Slf4jLog<br>
> Exception in thread "main" java.lang.RuntimeException: Could
not commit <br>
> session<br>
> at<br>
> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)<br>
> at<br>
> org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)<br>
> at<br>
> org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)<br>
> at com.rob.tests.AnyTest$.test2(AnyTest.scala:44)<br>
> at com.rob.tests.AnyTest$.main(AnyTest.scala:18)<br>
> at com.rob.tests.AnyTest.main(AnyTest.scala)<br>
> Caused by: javax.naming.NameNotFoundException; remaining name <br>
> 'UserTransaction'<br>
> at <br>
> org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576)<br>
> at <br>
> org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663)<br>
> at <br>
> org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678)<br>
> at<br>
> org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110)<br>
> at javax.naming.InitialContext.lookup(InitialContext.java:392)<br>
> at<br>
> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)<br>
> ... 5 more<br>
><br>
> (This test is in a class file called "AnyTest.scala")<br>
><br>
> Cheers, Rob<br>
><br>
> P.S. Thanks for your patience and help.<br>
><br>
><br>
> Am 08.06.2010, 09:44 Uhr, schrieb PAYET, Manuel<br>
> <manuel.payet@capgemini.com>:<br>
><br>
>> Robert, what's your application server, or your transaction manager?<br>
>> I successfully tested with bitronix in my J2SE application, and
with<br>
>> the jboss application server transaction manager.<br>
>><br>
>> I don't have any further idea for your problem, but, from my own
point<br>
>> of view, it's not so dirty to bind it to java:comp/UserTransaction,<br>
>> and is probably your only way to do things without patching the
code<br>
>> (as you seem to have seen in the source code<br>
>> "java:comp/UserTransaction" is not in a variable so...<br>
>><br>
>> -----Message d'origine-----<br>
>> De : robert.weissmann@web.de [mailto:robert.weissmann@web.de]
Envoyé :<br>
>> lundi 7 juin 2010 20:50 À : Rules Users List; Mark Proctor; PAYET,<br>
>> Manuel Objet : Re: [rules-users] Exception using persistence<br>
>><br>
>> For additional information:<br>
>><br>
>> JPAKnowledgeService.newStatefulKnowledgeSession uses<br>
>><br>
>> org.drools.persistence.session.SingleSessionCommandService<br>
>><br>
>> where "java:comp/UserTransaction" is used (I checked
the drools source<br>
>> code). Looks like there is no way to change this.<br>
>><br>
>> I just wonder that I am the only one having this problem.<br>
>><br>
>> As I said "comp/UserTransaction" works, but "java:comp/UserTransaction"<br>
>> doesn't, but in the docs "java:comp/UserTransaction"
is used !?!?!?<br>
>><br>
>> Cheers, Rob.<br>
>><br>
>> Am 07.06.2010, 16:22 Uhr, schrieb PAYET, Manuel<br>
>> <manuel.payet@capgemini.com>:<br>
>><br>
>>> It's probably that your transaction manager, for an odd reason,<br>
>>> doesn't bind with the good name; You can do the following
workaround:<br>
>>><br>
>>> Final InitialContext initContext = new InitialContext();<br>
>>> initContext.bind("java:comp/UserTransaction",initContext.lookup("comp<br>
>>> /<br>
>>> UserTransaction"));<br>
>>><br>
>>> And voila, those two jndi name should point to the same object.<br>
>>><br>
>>> I stress the fact that what I've written hasn't been tested.<br>
>>><br>
>>> -----Message d'origine-----<br>
>>> De : rules-users-bounces@lists.jboss.org<br>
>>> [mailto:rules-users-bounces@lists.jboss.org] De la part de
Robert<br>
>>> Envoyé : lundi 7 juin 2010 16:16 À : rules-users@lists.jboss.org;<br>
>>> Mark Proctor Objet : Re: [rules-users] Exception using persistence<br>
>>><br>
>>> Hi,<br>
>>><br>
>>> still struggling with this one (see below),<br>
>>><br>
>>> but I did a slide change in the test-code<br>
>>><br>
>>> try {<br>
>>> val env = new java.util.Hashtable[String,
String]<br>
>>> env.put(Context.INITIAL_CONTEXT_FACTORY,<br>
>>> "bitronix.tm.jndi.BitronixInitialContextFactory")<br>
>>> val ctx = new InitialContext(env)<br>
>>> val ut1 : UserTransaction = (ctx.lookup(<br>
>>> "java:comp/UserTransaction")).asInstanceOf[UserTransaction]<br>
>>> } catch {<br>
>>> case ex: Exception => ex.printStackTrace()<br>
>>> }<br>
>>><br>
>>> (Sorry, code is in Scala, but should not be a problem to read
it).<br>
>>><br>
>>> Instead of "java:comp/UserTransaction" (as written
in the docs) I<br>
>>> wrote "comp/UserTransaction" and it works.<br>
>>><br>
>>> But since this is some test-code and I am able to do the look-up
as I<br>
>>> want ("comp/UserTransaction"), as soon as I use<br>
>>><br>
>>><br>
>>> JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null,
env )<br>
>>><br>
>>><br>
>>> I have no influence anymore (its drools-code ;-) and it looks
like<br>
>>> its using internally "java:comp/UserTransaction".<br>
>>><br>
>>><br>
>>> Is there any way to change this (setting it) ?<br>
>>><br>
>>> Cheers, Rob<br>
>>><br>
>>><br>
>>><br>
>>> Am 01.06.2010, 23:54 Uhr, schrieb Robert <robert.weissmann@web.de>:<br>
>>><br>
>>>> Well, I tried this but it does not work.<br>
>>>><br>
>>>> Checking additionally the BitronixInitialContextFactory
API where it<br>
>>>> says:<br>
>>>><br>
>>>> ---------------------------------------------<br>
>>>> "Implementation of InitialContextFactory that allows
lookup of<br>
>>>> transaction manager and registered resources.<br>
>>>><br>
>>>> The easiest way to use this provider is to create a jndi.properties<br>
>>>> file in your classpath with this content:<br>
>>>> java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextF<br>
>>>> a c tory Alternatively, you can create a InitialContext
object with<br>
>>>> an environment pointing to this class:<br>
>>>> Hashtable env = new Hashtable();<br>
>>>> env.put(Context.INITIAL_CONTEXT_FACTORY,<br>
>>>> "bitronix.tm.jndi.BitronixInitialContextFactory");<br>
>>>> Context ctx = new InitialContext(env);<br>
>>>><br>
>>>> The transaction manager can be looked up at the standard
URL<br>
>>>> java:comp/UserTransaction while resources can be looked
up using<br>
>>>> their unique name as set in ResourceBean.getUniqueName().
"<br>
>>>> ---------------------------------------------<br>
>>>><br>
>>>><br>
>>>> So, I tried the following ( Its in Scala, but shouldn't
be a problem<br>
>>>> to<br>
>>>> read):<br>
>>>><br>
>>>> try {<br>
>>>> val env = new java.util.Hashtable[String,
String]<br>
>>>> env.put(Context.INITIAL_CONTEXT_FACTORY,<br>
>>>> "bitronix.tm.jndi.BitronixInitialContextFactory");<br>
>>>> val ctx = new InitialContext(env);<br>
>>>> val ut1 : UserTransaction = (ctx.lookup(<br>
>>>> "java:comp/UserTransaction"<br>
>>>> )).asInstanceOf[UserTransaction]<br>
>>>> } catch {<br>
>>>> case ex: Exception => ex.printStackTrace()<br>
>>>> }<br>
>>>><br>
>>>><br>
>>>> But still getting the same problem as before at line
"val ut1 : <br>
>>>> ...".<br>
>>>><br>
>>>> What I do not get is that the Bitronix API says that the
standard<br>
>>>> URL is "java:comp/UserTransaction", but its
somehow not found !?!?!?<br>
>>>><br>
>>>> Any ideas ?<br>
>>>><br>
>>>> Cheers, Rob.<br>
>>>><br>
>>>><br>
>>>><br>
>>>> Am 31.05.2010, 02:54 Uhr, schrieb Mark Proctor <br>
>>>> <mproctor@codehaus.org>:<br>
>>>><br>
>>>>> On 30/05/2010 20:28, Robert wrote:<br>
>>>>>> Hi, I followed the instructions on setting up
the persistence in<br>
>>>>>> the drools flow doc, but I get the following exception:<br>
>>>>>><br>
>>>>>><br>
>>>>>> Exception in thread "main" java.lang.RuntimeException:
Could not<br>
>>>>>> commit session<br>
>>>>>> at<br>
>>>>>> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)<br>
>>>>>> at<br>
>>>>>> org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)<br>
>>>>>> at<br>
>>>>>> org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)<br>
>>>>>> at<br>
>>>>>> com.rob.server.core.process.drools.tasks.DroolsProcessHandler.<init>(DroolsProcessHandler.scala:130)<br>
>>>>>> at<br>
>>>>>> com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler$.main(DroolsProcessHandler.scala:33)<br>
>>>>>> at<br>
>>>>>> com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler.<br>
>>>>>> m<br>
>>>>>> ain(DroolsProcessHandler.scala) Caused by:<br>
>>>>>> javax.naming.NameNotFoundException; remaining
name 'UserTransaction'<br>
>>>>>> at<br>
>>>>>> org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576)<br>
>>>>>> at<br>
>>>>>> org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663)<br>
>>>>>> at<br>
>>>>>> org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678)<br>
>>>>>> at<br>
>>>>>> org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110)<br>
>>>>>> at javax.naming.InitialContext.lookup(InitialContext.java:392)<br>
>>>>>> at<br>
>>>>>> org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)<br>
>>>>>> ... 5 more<br>
>>>>>><br>
>>>>>><br>
>>>>>> I have no idea what this means. I guess<br>
>>>>>> SingleSessionCommandService is looking up for
"UserTransaction", <br>
>>>>>> but whats the "UserTransaction"<br>
>>>>>> ?<br>
>>>>>><br>
>>>>> You need to configure JTA and JNDI, it uses the standard
JNDI<br>
>>>>> lookup mechanism to find the UserTransaction it's
to be associated <br>
>>>>> with.<br>
>>>>> See javadocs example here:<br>
>>>>> http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artif<br>
>>>>> a<br>
>>>>> c<br>
>>>>> t/trunk/target/javadocs/stable/drools-api/org/drools/persistence/jp</font></tt>
<br><tt><font size=2>>>>>> a<br>
>>>>> /<br>
>>>>> JPAKnowledgeService.html<br>
>>>>><br>
>>>>> Each transaction framework has a different way to
be configured,<br>
>>>>> some are simpler than others.<br>
>>>>><br>
>>>>> Mark<br>
>>>>>> Cheers, Rob.<br>
>>>>>><br>
>>>>>><br>
>>>>><br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> rules-users mailing list<br>
>>>>> rules-users@lists.jboss.org<br>
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users<br>
>>>><br>
>>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Erstellt mit Operas revolutionärem E-Mail-Modul:<br>
>>> http://www.opera.com/mail/<br>
>>> _______________________________________________<br>
>>> rules-users mailing list<br>
>>> rules-users@lists.jboss.org<br>
>>> https://lists.jboss.org/mailman/listinfo/rules-users<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> This message contains information that may be privileged or<br>
>>> confidential and is the property of the Capgemini Group. It
is<br>
>>> intended only for the person to whom it is addressed. If you
are not<br>
>>> the intended recipient, you are not authorized to read, print,<br>
>>> retain, copy, disseminate, distribute, or use this message
or any<br>
>>> part thereof. If you receive this message in error, please
notify the<br>
>>> sender immediately and delete all copies of this message.<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> rules-users mailing list<br>
>>> rules-users@lists.jboss.org<br>
>>> https://lists.jboss.org/mailman/listinfo/rules-users<br>
>><br>
>><br>
><br>
><br>
> --<br>
> Erstellt mit Operas revolutionärem E-Mail-Modul: <br>
> http://www.opera.com/mail/<br>
><br>
><br>
><br>
><br>
><br>
><br>
> This message contains information that may be privileged or confidential
<br>
> and is the property of the Capgemini Group. It is<br>
> intended only for the person to whom it is addressed. If you are not
the <br>
> intended recipient, you are not authorized to<br>
> read, print, retain, copy, disseminate, distribute, or use this message
<br>
> or any part thereof. If you receive this message<br>
> in error, please notify the sender immediately and delete all copies
of <br>
> this message.<br>
><br>
<br>
<br>
-- <br>
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/<br>
_______________________________________________<br>
rules-users mailing list<br>
rules-users@lists.jboss.org<br>
https://lists.jboss.org/mailman/listinfo/rules-users<br>
</font></tt>
<br>