Provided hibernate does not see persistence.xml loaded by custom classloader
jsvitak Nov 19, 2012 10:16 AMHello,
I don't know if this is the best place to ask this question, but I think it's a problem related to classloading in EAP 6. I am working on a jBPM plugin for Jenkins and jBPM uses Hibernate for persistence. I have configured my project to use Hibernate 4 provided by EAP 6. However Hibernate 4 cannot see persistence.xml file which is used in the plugin. I assume the problem is that Jenkins uses several classloaders and one of them is for the plugins (hudson.PluginManager.uberClassLoader). Plugins are not placed inside Jenkins .war file, but as .hpi (.jar) files in ~/.jenkins/plugins. So Hibernate 4 does not know about this classloader and cannot see the persistence.xml. Can you please tell me how to configure EAP or Hibernate to look for persistence.xml in Jenkins uberClassLoader?
Here is the output from EAP 6 server log:
15:50:18,993 INFO [org.hibernate.ejb.Ejb3Configuration] (Executor #0 for master : executing test-timer #12) HHH000318: Could not find any META-INF/persistence.xml file in the classpath
Jenkins web console says just this:
FATAL: No Persistence provider for EntityManager named org.jbpm.persistence.jpa
javax.persistence.PersistenceException: No Persistence provider for EntityManager named org.jbpm.persistence.jpa
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at org.jenkinsci.plugins.jbpm.SessionUtil.getPersistedSession(SessionUtil.java:102)
at org.jenkinsci.plugins.jbpm.SessionUtil.getStatefulKnowledgeSession(SessionUtil.java:91)
at org.jenkinsci.plugins.jbpm.JbpmUrlResourceBuilder.perform(JbpmUrlResourceBuilder.java:104)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:697)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:467)
at hudson.model.Run.run(Run.java:1404)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)