[jboss-user] [jBPM] - Seam, TestNG and Jbpm - Could not find datasource error

gabriel kb do-not-reply at jboss.com
Wed Jan 12 08:15:29 EST 2011


gabriel kb [http://community.jboss.org/people/gabriel.kb] created the discussion

"Seam, TestNG  and Jbpm - Could not find datasource error"

To view the discussion, visit: http://community.jboss.org/message/580295#580295

--------------------------------------------------------------
I'm using Seam 2.2, Eclipse 3.5, JBoss tools, jBPM 3.2.7 and the TestNG plugin for Eclipse.

I created a seam project and its test project with the jboss tools. It's a simple "to do list" seam-jbpm application and works fine. However, when I run my seam test (see below) I get this stacktrace:

INFO  [org.jbpm.JbpmConfiguration] using configuration resource: jbpm.cfg.xml
INFO  [org.jbpm.persistence.db.StaleObjectLogConfigurer] stale object exceptions will be hidden from logging
ERROR [org.hibernate.connection.DatasourceConnectionProvider] Could not find datasource: java:/EjemplosJbpmDatasource
java.lang.RuntimeException: PROVIDER_URL not provided in jndi.properties.  Automatic discovery not implemented yet.
          at org.jboss.naming.JBossRemotingContextFactory.getInitialContext(JBossRemotingContextFactory.java:158)
          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
          at javax.naming.InitialContext.init(InitialContext.java:223)
          at javax.naming.InitialContext.<init>(InitialContext.java:175)
          at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:51)
          at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
          at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
          at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)
          at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:448)
          at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
          at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
          at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:105)
          at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:84)
          at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:89)
          at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:340)
          at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:596)
          at org.jbpm.scheduler.db.DbSchedulerService.<init>(DbSchedulerService.java:49)
          at org.jbpm.scheduler.db.DbSchedulerServiceFactory.openService(DbSchedulerServiceFactory.java:32)
          at org.jbpm.svc.Services.getService(Services.java:155)
          at org.jbpm.svc.Services.getCurrentService(Services.java:93)
          at org.jbpm.svc.Services.getCurrentService(Services.java:86)
          at org.jbpm.scheduler.def.CreateTimerAction.execute(CreateTimerAction.java:79)
          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:280)
          at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:237)
          at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:207)
          at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:190)
          at org.jbpm.taskmgmt.exe.TaskInstance.create(TaskInstance.java:156)
          at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:191)
          at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:189)
          at org.jbpm.graph.def.Node.enter(Node.java:375)
          at org.jbpm.graph.def.Transition.take(Transition.java:151)
          at org.jbpm.graph.def.Node.leave(Node.java:453)
          at org.jbpm.graph.node.StartState.leave(StartState.java:78)
          at org.jbpm.graph.exe.Token.signal(Token.java:214)
          at org.jbpm.graph.exe.Token.signal(Token.java:143)
          at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:287)
          at org.ejemplosjbpm.test.SubProcesoTest.testMinimo(SubProcesoTest.java:25)
          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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:607)
          at org.testng.internal.Invoker.invokeMethod(Invoker.java:517)
          at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:669)
          at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:956)
          at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
          at org.testng.TestRunner.runWorkers(TestRunner.java:759)
          at org.testng.TestRunner.privateRun(TestRunner.java:592)
          at org.testng.TestRunner.run(TestRunner.java:486)
          at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
          at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
          at org.testng.SuiteRunner.run(SuiteRunner.java:204)
          at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877)
          at org.testng.TestNG.runSuitesLocally(TestNG.java:842)
          at org.testng.TestNG.run(TestNG.java:751)
          at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
          at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
ERROR [org.jbpm.graph.def.GraphElement] action threw exception: Could not find datasource
org.hibernate.HibernateException: Could not find datasource
          at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:79)
          at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
          at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)
          at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:448)
          at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
          at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
          at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:105)
          at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:84)
          at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:89)
          at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:340)
          at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:596)
          at org.jbpm.scheduler.db.DbSchedulerService.<init>(DbSchedulerService.java:49)
          at org.jbpm.scheduler.db.DbSchedulerServiceFactory.openService(DbSchedulerServiceFactory.java:32)
          at org.jbpm.svc.Services.getService(Services.java:155)
          at org.jbpm.svc.Services.getCurrentService(Services.java:93)
          at org.jbpm.svc.Services.getCurrentService(Services.java:86)
          at org.jbpm.scheduler.def.CreateTimerAction.execute(CreateTimerAction.java:79)
          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:280)
          at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:237)
          at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:207)
          at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:190)
          at org.jbpm.taskmgmt.exe.TaskInstance.create(TaskInstance.java:156)
          at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:191)
          at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:189)
          at org.jbpm.graph.def.Node.enter(Node.java:375)
          at org.jbpm.graph.def.Transition.take(Transition.java:151)
          at org.jbpm.graph.def.Node.leave(Node.java:453)
          at org.jbpm.graph.node.StartState.leave(StartState.java:78)
          at org.jbpm.graph.exe.Token.signal(Token.java:214)
          at org.jbpm.graph.exe.Token.signal(Token.java:143)
          at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:287)
          at org.ejemplosjbpm.test.SubProcesoTest.testMinimo(SubProcesoTest.java:25)
          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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:607)
          at org.testng.internal.Invoker.invokeMethod(Invoker.java:517)
          at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:669)
          at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:956)
          at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
          at org.testng.TestRunner.runWorkers(TestRunner.java:759)
          at org.testng.TestRunner.privateRun(TestRunner.java:592)
          at org.testng.TestRunner.run(TestRunner.java:486)
          at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
          at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
          at org.testng.SuiteRunner.run(SuiteRunner.java:204)
          at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:877)
          at org.testng.TestNG.runSuitesLocally(TestNG.java:842)
          at org.testng.TestNG.run(TestNG.java:751)
          at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
          at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
Caused by: java.lang.RuntimeException: PROVIDER_URL not provided in jndi.properties.  Automatic discovery not implemented yet.
          at org.jboss.naming.JBossRemotingContextFactory.getInitialContext(JBossRemotingContextFactory.java:158)
          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
          at javax.naming.InitialContext.init(InitialContext.java:223)
          at javax.naming.InitialContext.<init>(InitialContext.java:175)
          at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:51)
          at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
          ... 54 more
FAILED: testMinimo
org.jbpm.graph.def.DelegationException: Could not find datasource
          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:359)
          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:350)
          at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:350)
          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:296)
          at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:237)
          at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:207)
          at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:190)
          at org.jbpm.taskmgmt.exe.TaskInstance.create(TaskInstance.java:156)
          at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:191)
          at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:189)
          at org.jbpm.graph.def.Node.enter(Node.java:375)
          at org.jbpm.graph.def.Transition.take(Transition.java:151)
          at org.jbpm.graph.def.Node.leave(Node.java:453)
          at org.jbpm.graph.node.StartState.leave(StartState.java:78)
          at org.jbpm.graph.exe.Token.signal(Token.java:214)
          at org.jbpm.graph.exe.Token.signal(Token.java:143)
          at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:287)
          at org.ejemplosjbpm.test.SubProcesoTest.testMinimo(SubProcesoTest.java:25)
Caused by: org.hibernate.HibernateException: Could not find datasource
          at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:79)
          at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
          at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)
          at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:448)
          at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
          at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
          at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:105)
          at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:84)
          at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:89)
          at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:340)
          at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:596)
          at org.jbpm.scheduler.db.DbSchedulerService.<init>(DbSchedulerService.java:49)
          at org.jbpm.scheduler.db.DbSchedulerServiceFactory.openService(DbSchedulerServiceFactory.java:32)
          at org.jbpm.svc.Services.getService(Services.java:155)
          at org.jbpm.svc.Services.getCurrentService(Services.java:93)
          at org.jbpm.svc.Services.getCurrentService(Services.java:86)
          at org.jbpm.scheduler.def.CreateTimerAction.execute(CreateTimerAction.java:79)
          at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:280)
          ... 36 more
Caused by: java.lang.RuntimeException: PROVIDER_URL not provided in jndi.properties.  Automatic discovery not implemented yet.
          at org.jboss.naming.JBossRemotingContextFactory.getInitialContext(JBossRemotingContextFactory.java:158)
          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
          at javax.naming.InitialContext.init(InitialContext.java:223)
          at javax.naming.InitialContext.<init>(InitialContext.java:175)
          at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:51)
          at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)


This is my test class:

public class SubProcesoTest{
 
  @Test
  public void testMinimo() throws Exception {
  JbpmConfiguration jbpmConfig = JbpmConfiguration.getInstance();
  JbpmContext jbpmContext = jbpmConfig.createJbpmContext();
  try {
 
 
  ProcessDefinition subProceso = ProcessDefinition
  .parseXmlResource("subproceso/processdefinition.xml");
  ProcessInstance subProcesoPI = subProceso.createProcessInstance();
  Assert.assertEquals(
  subProcesoPI.getRootToken().getNode().getName(), "start");
 
 
  subProcesoPI.signal();
 
 
  Assert.assertEquals(
  subProcesoPI.getRootToken().getNode().getName(), "todo");
  } finally {
  jbpmContext.close();
  }
  }
}


This is the persistence unit defined in the persistence.xml for the project:

  <persistence-unit name="EjemplosJbpm" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/EjemplosJbpmDatasource</jta-data-source>
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
         <property name="hibernate.hbm2ddl.auto" value="update"/>
         <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.format_sql" value="true"/>
         <!-- Only relevant if Seam is loading the persistence unit (Java SE bootstrap) -->
         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
      </properties>
   </persistence-unit>



And the jbpm.cfg.xml:

<jbpm-configuration>


          <jbpm-context>
                    <service name="persistence">
                              <factory>
                                        <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
                                                  <field name="isTransactionEnabled">
                                                            <false />
                                                  </field>
                                        </bean>
                              </factory>


                    </service>


                    <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
                    <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
                    <service name="scheduler"
                              factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
                    <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
                    <service name="authentication"
                              factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
          </jbpm-context>
</jbpm-configuration>



I've spent several days reading many threads (like this one  http://seamframework.org/Community/UnitTestCouldNotFindDatasourceJavaDefaultDS ttp://seamframework.org/Community/UnitTestCouldNotFindDatasourceJavaDefaultD) and trying many "workarounds" but nothing of that worked.

Thanks in advance for your help.

Kind regards, 
GK
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/580295#580295]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110112/f4b15129/attachment-0001.html 


More information about the jboss-user mailing list