title: jBPM Persistence: Unable to build EntityManagerFactory
body: <p>I am trying to make my jBPM Project persistent. Therefore I used the this <a href="http://docs.jboss.org/jbpm/v5.2/userguide/ch07.html" rel="nofollow">tutorial</a>.
  At first I imported all the additional jars needed (according to the website). 
  I also added <code>mysql-connector-java-5.1.20-bin.jar</code> because I want to use mysql as persistent storage.</p>
  
  <p>After that I added the "stateful" code to my project:</p>
  
  <pre><code>KnowledgeBase kbase = readKnowledgeBase(name);
  StatefulKnowledgeSession ksession = null;
  JBPMHelper.startH2Server();
  JBPMHelper.setupDataSource();
  if(ProcessManager.sessionId == -1){
      ksession = JBPMHelper.newStatefulKnowledgeSession(kbase);
      ProcessManager.sessionId = ksession.getId();
  }
  else {
  ksession = JBPMHelper.loadStatefulKnowledgeSession(
      kbase,
      ProcessManager.sessionId);
  }
  </code></pre>
  
  <p>Then I added to <code>resources/META-INF</code> the file <code>jBPM.properties</code>:</p>
  
  <blockquote>
    <p>persistence.datasource.name=jdbc/jbpm-ds</p>
    
    <p>persistence.datasource.user=test</p>
    
    <p>persistence.datasource.password=test</p>
    
    <p>persistence.datasource.url=jdbc:mysql://localhost:3306/helpme</p>
    
    <p>persistence.datasource.driverClassName=com.mysql.jdbc.Driver</p>
    
    <p>persistence.enabled=true</p>
    
    <p>persistence.persistenceunit.name=org.jbpm.persistence.jpa</p>
    
    <p>persistence.persistenceunit.dialect=org.hibernate.dialect.MySQLDialect</p>
  </blockquote>
  
  <p>If I now run the project there is always the following exception (on <code>ksession = JBPMHelper.newStatefulKnowledgeSession(kbase);</code>):</p>
  
  <blockquote>
    <p>javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory</p>
    
    <p>Caused by: org.hibernate.HibernateException: Could not find datasource</p>
    
    <p>Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context</p>
  </blockquote>