[jboss-user] [jBPM] - persistence JBPM5.3 on tomcat with mysql

Kehua Gao do-not-reply at jboss.com
Sat Nov 10 10:48:37 EST 2012


Kehua Gao [https://community.jboss.org/people/kehuagao] created the discussion

"persistence JBPM5.3 on tomcat with mysql"

To view the discussion, visit: https://community.jboss.org/message/775867#775867

--------------------------------------------------------------
Hi,
EntityManagerFactory emfTask = Persistence.createEntityManagerFactory("org.jbpm.task");
the above line code works fine,but the below line code do not work.
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
the error is: 
 Could not find datasource: jdbc/jbpm-ds
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
 at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
 at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
 at javax.naming.InitialContext.lookup(InitialContext.java:411)
 at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
 at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
 at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
 at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
 at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
 at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
 at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
 at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
 at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
 at com.sample.processserver.JbpmAPIUtil.createSession(JbpmAPIUtil.java:257)
 at com.sample.processserver.JbpmAPIUtil.getSession(JbpmAPIUtil.java:238)
 at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:69)
 at javax.servlet.GenericServlet.init(GenericServlet.java:212)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
 at org.apache.catalina.core.StandardService.start(StandardService.java:525)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
 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:601)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
1    10/11 23:36:38,784[main] ERROR sample.processserver.TaskProcessServlet.init  - [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory
org.hibernate.HibernateException: Could not find datasource

My persistence.xml is :
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence"
    xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence 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/persistence_1_0.xsd" version="1.0">
    
    <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>jdbc/jbpm-ds</jta-data-source>
   
        <mapping-file>META-INF/orm.xml</mapping-file>
   
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</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>       
       
        <class>org.jbpm.task.Task</class>
  <class>org.jbpm.task.Comment</class>
  <class>org.jbpm.task.Attachment</class>
  <class>org.jbpm.task.I18NText</class>
  <class>org.jbpm.task.SubTasksStrategy</class>
  <class>org.jbpm.task.Deadline</class>
  <class>org.jbpm.task.Escalation</class>
  <class>org.jbpm.task.Reassignment</class>
  <class>org.jbpm.task.Notification</class>
  <class>org.jbpm.task.BooleanExpression</class>
  <class>org.jbpm.task.User</class>
  <class>org.jbpm.task.PeopleAssignments</class>
 
 
        <properties>
            
             <!-- H2 dialect -->
            <!--   <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>   -->
           
           <!-- Oracle dialect --> 
               <!--   <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/> -->
          
           
             <!-- mysql dialect --> 
             
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
           
             
            <property name="hibernate.connection.autocommit" value="false"/>
            <property name="hibernate.max_fetch_depth" value="3"/>
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
        </properties>
      
      
    </persistence-unit>
    <persistence-unit name="org.jbpm.task">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
         
        <mapping-file>META-INF/Taskorm.xml</mapping-file>
   
        <class>org.jbpm.task.Attachment</class>
        <class>org.jbpm.task.Content</class>
        <class>org.jbpm.task.BooleanExpression</class>
        <class>org.jbpm.task.Comment</class>
        <class>org.jbpm.task.Deadline</class>
        <class>org.jbpm.task.Comment</class>
        <class>org.jbpm.task.Deadline</class>
        <class>org.jbpm.task.Delegation</class>
        <class>org.jbpm.task.Escalation</class>
        <class>org.jbpm.task.Group</class>
        <class>org.jbpm.task.I18NText</class>
        <class>org.jbpm.task.Notification</class>
        <class>org.jbpm.task.EmailNotification</class>
        <class>org.jbpm.task.EmailNotificationHeader</class>
        <class>org.jbpm.task.PeopleAssignments</class>
        <class>org.jbpm.task.Reassignment</class>
        <class>org.jbpm.task.Status</class>
        <class>org.jbpm.task.Task</class>
        <class>org.jbpm.task.TaskData</class>
        <class>org.jbpm.task.SubTasksStrategy</class>
        <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
        <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
        <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
        <class>org.jbpm.task.User</class>
 
        <class>org.drools.persistence.info.SessionInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>
        <class>org.drools.persistence.info.WorkItemInfo</class>

        <properties>
             <!-- sample H2 configuration  
             
            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
            <property name="hibernate.connection.url" value="jdbc:h2:mem:droolsflow" />
            <property name="hibernate.connection.username" value="sa"/>
            <property name="hibernate.connection.password" value="sasa"/>
          -->
           
            <!-- Sample Oracle Configuration  
            
             <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
            <property name="hibernate.connection.url" value="jdbc:oracle:thin:oracleserver:1521:db" />
            <property name="hibernate.connection.username" value="nagios"/>
            <property name="hibernate.connection.password" value="nagios"/>
            -->
             
             <!-- Sample mysql Configuration  -->
                         
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/jbpm-demo" />
            <property name="hibernate.connection.username" value="demo"/>
            <property name="hibernate.connection.password" value="demo"/>
            
            
            
            <property name="hibernate.connection.autocommit" value="true" />
            <property name="hibernate.max_fetch_depth" value="3"/>
            <property name="hibernate.hbm2ddl.auto" value="create" />
            <property name="hibernate.show_sql" value="false" />
        </properties>
    </persistence-unit>
</persistence>
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://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/20121110/c1058399/attachment-0001.html 


More information about the jboss-user mailing list