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

ProcessClassLoader : cannot load resource from code deployed inside a process archive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 3.2.2
    • jBPM 3.2.0
    • Runtime Engine
    • None

      A Java class deployed with a process archive may need access to a class path resource deployed in the same process archive.

      A common example is an ActionHandler implementation that calls a remote EJB and needs a jndi.properties file containin remote appserver location. In order to load that it calls :

      this.getClass().getClassLoader().getResourceAsStream("jndi.properties")

      This call generates a java.lang.NullPointerException which I think justifies the classification of this issue as a bug.

      Looking inside the ProcessClassLoader class, I see that in order to load a class, a "classes/" prefix. Indeed, the "par" format wants that all compiled classes be locates underneath the "classes/" directory. The JBPM_BYTEARRAY.NAME_ field in the database table confirms this : the NAME_ of the jndi.properties resource is : "classes/jndi.properties".

      Still the ProcessClassLoader.getResourceAsStream method does not use the classes prefix.

      The fix look thus simple, i.e. adding that prefix.

      Second problem : if the resource is not found, a delegation should be made to the parent classloader.

            tom.baeyens Tom Baeyens (Inactive)
            gogoasa_jira Adrian Dimulescu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: