0 Replies Latest reply on Sep 20, 2012 2:43 AM by Bujji Bujji

    org.hibernate.HibernateException: Could not find datasource: java:jboss/datasources/jbpmDS

    Bujji Bujji Newbie

      Please help us on the below issue. we are struggling with this from quite a long time.

       

       

      We are working on JBPM 5.3 set up on Jboss AS 7.0.2. When we are opening jbpm console using the url http://localhost:8280/jbpm-console

       

      we are are getting org.hibernate.HibernateException: Could not find datasource: java:jboss/datasources/jbpmDS error.

       

       

       

      We have tried with custom transaction manager lookup as you suggested, but it is in vain. we are still getting the following problem.

      org.hibernate.HibernateException: Could not find datasource: java:jboss/datasources/jbpmDS

       

      Here is 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.jbpm.persistence.jpa" transaction-type="JTA">
          
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
           
      <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
          
      <mapping-file>META-INF/JBPMorm.xml</mapping-file>
          
      <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>

          
      <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
          
      <class>org.drools.persistence.info.SessionInfo</class>
          
      <class>org.drools.persistence.info.WorkItemInfo</class>

          
      <class>org.jbpm.process.audit.ProcessInstanceLog</class>
          
      <class>org.jbpm.process.audit.NodeInstanceLog</class>
          
      <class>org.jbpm.process.audit.VariableInstanceLog</class>

          
      <properties>
            
      <!-- <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
             <property name="hibernate.hbm2ddl.auto" value="create" />
           
             <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
            <property name="hibernate.connection.url" value="jdbc:mysql://127.0.0.1:3306/test" />
            <property name="hibernate.connection.username" value="root"/>
            <property name="hibernate.connection.password" value=""/>
            <property name="hibernate.connection.autocommit" value="false" />   -->
      <!-- <property name="jta.UserTransaction" value = "java:jboss/TransactionManager"/> -->
            
      <!--  <property name="jta.data.source" value="java:jboss/datasources/jbpmDS"/> -->
            
      <!--  <property name="hibernate.max_fetch_depth" value="3"/>  -->
            
      <!-- hbm2ddl.auto MUST BE update! The console will otherwise overwrite the schema with each new thread -->
           
            
      <property name="hibernate.show_sql" value="true" />

            
      <!-- for AS7 -->
            
      <property name="hibernate.transaction.manager_lookup_class" value="org.jbpm.integration.console.JBPMTransactionManager" />
            
      <!-- for AS5 -->
            
      <!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> -->
          
      </properties>       
        
      </persistence-unit>
          
      </persistence>

       

       

      We have created the data source by making an entry into standalone.xml like the following. And we can see the Data source being created on server with the name java:jboss/datasources/jbpmDS using jboss console.


       

       

      <datasources>
                       <datasource jndi-name="java:jboss/datasources/jbpmDS" pool-name="MysqlJbpmDSPool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                           <connection-url>
                               jdbc:mysql://127.0.0.1:3306/test
                           </connection-url>
                           <driver>
                               mysql
                           </driver>
                           <pool>
                               <prefill>
                                   false
                               </prefill>
                               <use-strict-min>
                                   false
                               </use-strict-min>
                               <flush-strategy>
                                   FailingConnectionOnly
                               </flush-strategy>
                           </pool>
                           <security>
                               <user-name>
                                   root
                               </user-name>
                               <password>
                                  
                               </password>
                           </security>
                       </datasource>
                       <datasource jndi-name="java:jboss/datasources/jbpm-ds" pool-name="MysqlJbpmDSPool1" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                           <connection-url>
                               jdbc:mysql://127.0.0.1:3306/test
                           </connection-url>
                           <driver>
                               mysql
                           </driver>
                           <pool>
                               <prefill>
                                   false
                               </prefill>
                               <use-strict-min>
                                   false
                               </use-strict-min>
                               <flush-strategy>
                                   FailingConnectionOnly
                               </flush-strategy>
                           </pool>
                           <security>
                               <user-name>
                                   root
                               </user-name>
                               <password>
                                  
                               </password>
                           </security>
                       </datasource>
                       <drivers>
                           <driver name="mysql" module="com.mysql">
                               <xa-datasource-class>
                                   com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
                               </xa-datasource-class>
                           </driver>
                       </drivers>
                   </datasources>

       

       

       

       


       

      We can see the following trace on the Jboss AS console :

       

      11:02:34,919 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/gwt-console-server].[Resteasy]] (http--127.0.0.1-8280-2) Servlet.service() for servlet Resteasy threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.ExceptionInInitializerError

        at org.jboss.resteasy.core.SynchronousDispatcher.unwrapException(SynchronousDispatcher.java:345) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:321) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:534) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.2.1.GA.jar:]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59) [classes:]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]

        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:480) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

        at java.lang.Thread.run(Thread.java:680) [:1.6.0_33]

      Caused by: java.lang.ExceptionInInitializerError

        at org.jbpm.integration.console.StatefulKnowledgeSessionUtil.getStatefulKnowledgeSession(StatefulKnowledgeSessionUtil.java:131) [jbpm-gwt-core-5.3.0.Final.jar:]

        at org.jbpm.integration.console.SessionInitializer.<init>(SessionInitializer.java:25) [jbpm-gwt-core-5.3.0.Final.jar:]

        at org.jbpm.integration.console.TaskManagement.<init>(TaskManagement.java:51) [jbpm-gwt-core-5.3.0.Final.jar:]

        at org.jbpm.integration.console.ManagementFactory.createTaskManagement(ManagementFactory.java:26) [jbpm-gwt-core-5.3.0.Final.jar:]

        at org.jbpm.integration.console.ManagementFactory.createTaskManagement(ManagementFactory.java:19) [jbpm-gwt-core-5.3.0.Final.jar:]

        at org.jboss.bpm.console.server.TaskListFacade.getTaskManagement(TaskListFacade.java:72) [classes:]

        at org.jboss.bpm.console.server.TaskListFacade.getTasksForIdRef(TaskListFacade.java:101) [classes:]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_33]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_33]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_33]

        at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_33]

        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209) [resteasy-jaxrs-2.2.1.GA.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519) [resteasy-jaxrs-2.2.1.GA.jar:]

        ... 24 more

      Caused by: java.lang.RuntimeException: Could not initialize stateful knowledge session: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory

        at org.jbpm.integration.console.StatefulKnowledgeSessionUtil.initializeStatefulKnowledgeSession(StatefulKnowledgeSessionUtil.java:163) [jbpm-gwt-core-5.3.0.Final.jar:]

        at org.jbpm.integration.console.StatefulKnowledgeSessionUtil$SessionHolder.<clinit>(StatefulKnowledgeSessionUtil.java:127) [jbpm-gwt-core-5.3.0.Final.jar:]

        ... 40 more

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677) [hibernate-entitymanager-3.4.0.GA.jar:]

        at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126) [hibernate-entitymanager-3.4.0.GA.jar:]

        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

        at org.jbpm.integration.console.StatefulKnowledgeSessionUtil.createOrLoadStatefulKnowledgeSession(StatefulKnowledgeSessionUtil.java:263) [jbpm-gwt-core-5.3.0.Final.jar:]

        at org.jbpm.integration.console.StatefulKnowledgeSessionUtil.initializeStatefulKnowledgeSession(StatefulKnowledgeSessionUtil.java:154) [jbpm-gwt-core-5.3.0.Final.jar:]

        ... 41 more

      Caused by: org.hibernate.HibernateException: Could not find datasource: java:jboss/datasources/jbpmDS

        at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:98) [classes:]

        at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137) [hibernate-core-3.3.2.GA.jar:]

        at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29) [hibernate-entitymanager-3.4.0.GA.jar:]

        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89) [hibernate-core-3.3.2.GA.jar:]

        at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) [hibernate-core-3.3.2.GA.jar:]

        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) [hibernate-core-3.3.2.GA.jar:]

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) [hibernate-core-3.3.2.GA.jar:]

        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) [hibernate-annotations-3.4.0.GA.jar:]

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) [hibernate-entitymanager-3.4.0.GA.jar:]

        ... 46 more