Well, I tried this but it does not work.
Checking additionally the BitronixInitialContextFactory API where it says:
---------------------------------------------
"Implementation of InitialContextFactory that allows lookup of transaction
manager and registered resources.
The easiest way to use this provider is to create a jndi.properties file
in your classpath with this content:
java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory
Alternatively, you can create a InitialContext object with an environment
pointing to this class:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"bitronix.tm.jndi.BitronixInitialContextFactory");
Context ctx = new InitialContext(env);
The transaction manager can be looked up at the standard URL
java:comp/UserTransaction while resources can be looked up using their
unique name as set in ResourceBean.getUniqueName(). "
---------------------------------------------
So, I tried the following ( Its in Scala, but shouldn't be a problem to
read):
try {
val env = new java.util.Hashtable[String, String]
env.put(Context.INITIAL_CONTEXT_FACTORY,
"bitronix.tm.jndi.BitronixInitialContextFactory");
val ctx = new InitialContext(env);
val ut1 : UserTransaction = (ctx.lookup( "java:comp/UserTransaction"
)).asInstanceOf[UserTransaction]
} catch {
case ex: Exception => ex.printStackTrace()
}
But still getting the same problem as before at line "val ut1 : ...".
What I do not get is that the Bitronix API says that the standard URL is
"java:comp/UserTransaction", but its somehow not found !?!?!?
Any ideas ?
Cheers, Rob.
Am 31.05.2010, 02:54 Uhr, schrieb Mark Proctor <mproctor(a)codehaus.org>:
On 30/05/2010 20:28, Robert wrote:
> Hi, I followed the instructions on setting up the persistence in the
> drools flow doc, but I get the following exception:
>
>
> Exception in thread "main" java.lang.RuntimeException: Could not commit
> session
> at
>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:133)
> at
>
org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
> at
>
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
> at
>
com.rob.server.core.process.drools.tasks.DroolsProcessHandler.<init>(DroolsProcessHandler.scala:130)
> at
>
com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler$.main(DroolsProcessHandler.scala:33)
> at
>
com.rob.server.core.process.drools.tasks.StartDroolsProcessHandler.main(DroolsProcessHandler.scala)
> Caused by: javax.naming.NameNotFoundException; remaining name
> 'UserTransaction'
> at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576)
> at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663)
> at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678)
> at
> org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110)
> at javax.naming.InitialContext.lookup(InitialContext.java:392)
> at
>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)
> ... 5 more
>
>
> I have no idea what this means. I guess SingleSessionCommandService is
> looking up for "UserTransaction", but whats the "UserTransaction"
?
>
You need to configure JTA and JNDI, it uses the standard JNDI lookup
mechanism to find the UserTransaction it's to be associated with. See
javadocs example here:
http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/tr...
Each transaction framework has a different way to be configured, some
are simpler than others.
Mark
> Cheers, Rob.
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Erstellt mit Operas revolutionärem E-Mail-Modul:
http://www.opera.com/mail/