1 Reply Latest reply on Nov 12, 2013 7:12 AM by snj grg

    Custom class loader in jbpm5.4

    snj grg Newbie

      Hi,

       

             I am using JBPM 5.4 in a Java SE application.  The application uses a custom class loader and I need jbpm process engine to use this class loader for loading my classes, for example, some process variables. Is there any way to configure a custom class loader in jbpm5? I am very new to jbpm and any help or pointers would be highly appreciated.

       

      Thanks

        • 1. Re: Custom class loader in jbpm5.4
          snj grg Newbie

          Got it working now, had to refer drools code and doc. Not sure whether this is the right way though.

           

          ClassLoader[] classLoaders = { getClass().getClassLoader() }; // Custom class loader

          KnowledgeBuilderConfiguration kbuilderConf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null, classLoaders);

          KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderConf);

          kbuilder.add(ResourceFactory.newFileResource("logic/LeaveApplication.bpmn"), ResourceType.BPMN2);

          KnowledgeBaseConfiguration kconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null, classLoaders);

          KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( kconf );

          kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );