Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-4868

KModuleDeploymentService with JPAPlaceholderStrategy - class loader issue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • jBPM 6.3.0.Final
    • jBPM 6.3.0.Final
    • Runtime Engine
    • None
    • NEW
    • NEW
    • Hide

      I have attached one jbpm project and the sources for an example project.
      After running maven install on "org.demo.test" and maven package on "demo_app" deploy
      "jbpmdemo.ear". A startup bean will try to deploy the jbpm project and fail with:

      Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named demo:test:1.0
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
      at org.jbpm.runtime.manager.impl.jpa.EntityManagerFactoryManager.getOrCreate(EntityManagerFactoryManager.java:49)
      at org.jbpm.kie.services.impl.KModuleDeploymentService.boostrapRuntimeEnvironmentBuilder(KModuleDeploymentService.java:224)
      at org.jbpm.kie.services.impl.KModuleDeploymentService.deploy(KModuleDeploymentService.java:156)

      Show
      I have attached one jbpm project and the sources for an example project. After running maven install on "org.demo.test" and maven package on "demo_app" deploy "jbpmdemo.ear". A startup bean will try to deploy the jbpm project and fail with: Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named demo:test:1.0 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39) at org.jbpm.runtime.manager.impl.jpa.EntityManagerFactoryManager.getOrCreate(EntityManagerFactoryManager.java:49) at org.jbpm.kie.services.impl.KModuleDeploymentService.boostrapRuntimeEnvironmentBuilder(KModuleDeploymentService.java:224) at org.jbpm.kie.services.impl.KModuleDeploymentService.deploy(KModuleDeploymentService.java:156)

      When deploying a project using JPAPlaceholderStrategy the KModuleDeploymentService fails
      with "No Persistence provider for EntityManager named demo:test:1.0".

      The reason is, that the persistence.xml has been loaded by the project classloader,
      but KModuleDeploymentService.boostrapRuntimeEnvironmentBuilder(...) is run with a different (war module) class loader.
      The error can be avoided by using the code from JPAPlaceholderStrategy's constructor
      (switching the currentThread classloader with the project classloader). So that the provided persistence.xml can be located by the active classloader within the project. This again results in a new error so is probably no solution.

              swiderski.maciej Maciej Swiderski (Inactive)
              khirschmann Kevin Hirschmann (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: