1 Reply Latest reply on Apr 22, 2008 9:34 AM by Taj

    Problem in deploying processdefinition in a war file

    Taj Newbie


      I have a war file, which has a servlet that will load on startup to deploy my process definitions like the following -

      pdSubProcess = processDefinition.parseXmlResource("AutomationService/processdefinition.xml");

      I get a java.net.MalformedURLException, cause the class loader is not able to find the process definition, which is strange because it is in the classes folder in WEB-INF


      I saw the JBOSS code that loads the resource files, it uses the ClassLoader to deploy the resource. I mimicked that code like this

      ClassLoader automationServiceLoader = AutomationServiceServlet.class.getClassLoader();
      InputStream inputStream = automationServiceLoader.getResourceAsStream("AutomationService/processdefinition.xml");
      pdSuperProcess = ProcessDefinition.parseXmlInputStream(inputStream);

      The above code works, but created a new problem. I also wonder why didn't ProcessDefinition.parseXmlResource work because internally it does the same thing, using its own class - ClassLoaderUtil.class.getClassLoader()

      I am stumped.

      Now the second problem, after making the above work and once all the process definitions are deployed, the action classes that they refer to from the process definitions are not visible to class loader, and I get a ClassNotFoundException. I tried making a jar file and placing it in the WEB-INF\lib folder as well, with no success. I guess thats because I am using a different class loader to load the process definitions, the class folder in WEB-INF or the lib folders are not visible to it.

      Thus how do I actually make this work, how do I deploy the processdefinitions along with its related class files.

      Any help would be appreciated. Stuck from some time on this one.

        • 1. Re: Problem in deploying processdefinition in a war file - S
          Taj Newbie

          Solved the problem

          When we use the following code


          to parse the xml so that we can deploy it, It uses a ClassLoader internally instantiated by its own custom class – ClassLoaderUtil.java to load the resource, and for some reason it searches for the resources with respect to where the lib file – jbpm-jpdl.jar is present.

          Till now I had placed the jar files in the <Jboss_home>\server\default\lib. I removed them and placed them in the automation.war/WEB-INF/lib and now it works. Am I missing something. How can the resource loader search with respect to where the lib is placed, shouldn’t it searching the entire classpath?

          If I create my own class loader I am able to place it in the classpath and it picks it up, but since that would instantiate a separate class loader, it cannot find the action classes that would have been loaded by JBOSS class loader.

          I know I am missing something, though it works now, I really would like to know why is the above phenomenon occurring.