Search code examples
javamysqljbpmbitronix

What is the correct Transaction Manager to use in AS7 (and JBPM 6.2) in Java?


I hope someone can answer this before I spend hours trying to figure it out!

I'm using the PoolingDataSource Class to instantiate my transaction manager. However, I'm not having much success with it.

MySQL is my default database. I'm using:

 PoolingDataSource ds = new PoolingDataSource();

   ds.setUniqueName("java:jboss/datasources/jbpmDS");
   ds.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource");
  ds.setMaxPoolSize(3);
  ds.setAllowLocalTransactions(true);
  ds.getDriverProperties().put("user", "root");
  ds.getDriverProperties().put("password", "rootpass");
  ds.getDriverProperties().put("URL", "jdbc:mysql://localhost:3306/jbpm6");
  ds.getDriverProperties().put("driverClassName", "com.mysql.Driver");

  ds.init();

I get this when I run the code:

bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named java:jboss/datasources/jbpmDS
  at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:92)
  at com.sample.ProcessTest.testProcess(ProcessTest.java:67)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  at [email protected]$1.schedule(ParentRunner.java:63)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: bitronix.tm.utils.PropertyException: no writeable property 'URL' in class 'bitronix.tm.resource.jdbc.lrc.LrcXADataSource'
  at bitronix.tm.utils.PropertyUtils.getSetter(PropertyUtils.java:318)
  at bitronix.tm.utils.PropertyUtils.setDirectProperty(PropertyUtils.java:217)
  at bitronix.tm.utils.PropertyUtils.setProperty(PropertyUtils.java:83)
  at bitronix.tm.resource.common.XAPool.createXAFactory(XAPool.java:304)
  at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:63)
  at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:101)
  at bitronix.tm.r esource.jdbc.PoolingDataSource.init(PoolingDataSource.java:88)
  ... 26 more


Solution

  • Caused by: bitronix.tm.utils.PropertyException: no writeable property 'URL' ...

    This is because the correct property name is "url" (lowercase)