HELP ! Unable to build entity manager factory... unable to find a bound object at name 'java:jboss/datasources/jbpmDS'
tonycattlin Feb 4, 2016 4:16 AMJBPM 6.3.0
Wildfly 8.1.0 Standalone
I hope someone out there can help me out. I have been tearing my hair out for a few days now on this one...
I am writing a jbpm console and want to get a list of tasks assigned to a user. Once I have the task service I will be off and running but I am getting the error below when running the code to create the EntityManagerFactory. All deploys fine and I see the hibernate introspection of JBPM tables (if I had the JNDI name wrong this wouldn't work, right ?).
- I have the Datasource configured in Wildfly as can be seen in Standalone.xml and the Wildfly admin console
- I have the Datasource referenced in Persistence.xml
- Do I need to do something else ?
Any help very much appreciated.
Thanks
Snippets below:
Code...
public TaskService getTaskService() {
org.kie.api.runtime.manager.RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(Persistence.createEntityManagerFactory("com.mypackage.persistence.jpa")).persistence(true);
RuntimeManagerFactory mf = RuntimeManagerFactory.Factory.get();
RuntimeManager runtimeManager = mf.newSingletonRuntimeManager(builder.get());
return runtimeManager.getRuntimeEngine(EmptyContext.get()).getTaskService();
}
Persistence.xml...
...
<persistence-unit name="com.mypackage.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
...
Standalone_full.xml
...
<datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:h2:tcp://localhost/~/jbpm-db;MVCC=TRUE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
</security>
</datasource>
...
Error
...
2016-02-04 08:59:24,175 INFO [org.hibernate.jpa.internal.util.LogHelper] (default task-1) HHH000204: Processing PersistenceUnitInfo [name: com.mypackage.persistence.jpa
...]
2016-02-04 08:59:24,261 ERROR [stderr] (default task-1) javax.persistence.PersistenceException: Unable to build entity manager factory
2016-02-04 08:59:24,269 ERROR [stderr] (default task-1) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:83)
2016-02-04 08:59:24,285 ERROR [stderr] (default task-1) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
2016-02-04 08:59:24,293 ERROR [stderr] (default task-1) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
...
Caused by: org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name [java:jboss/datasources/jbpmDS]
...
Caused by: javax.naming.NameNotFoundException: unable to find a bound object at name 'java:jboss/datasources/jbpmDS'