4 Replies Latest reply on Sep 21, 2012 7:20 AM by Houssem Salah

    Tomcat6 + Spring + JBPM5.3 integration

    Houssem Salah Newbie

      Hello

       

      I have a web application configured to work in tomcat using spring . I'm trying to add JBPM workflow engine to my application.

      I have configured persistence to work with MySql and JPA 2.0 in persistence.xml. and I have added a spring bean contaning transaction manager and EntityManagerFactory.

      My probleme is I got the error saying could not parse knowledge when running the following:

       

       

      KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
      kbuilder.add(ResourceFactory.newClassPathResource("process/Evaluation.bpmn"), ResourceType.BPMN2); 
      
      KnowledgeBuilderErrors errors = kbuilder.getErrors();
      
      
      
      KnowledgeBase kbase = kbuilder.newKnowledgeBase();
      
      

       

      The line in green check if there is any errors. it contain [ProcessLoadError: unable to parse xml : Exception class java.lang.NullPointerException : null]

       

      Any help will be great

      Thinx

        • 1. Re: Tomcat6 + Spring + JBPM5.3 integration
          Jean-Jacques Borie Newbie

          Did you put : process/Evaluation.bpmn in src/main/resources ?

           

          It should work.

          • 2. Re: Tomcat6 + Spring + JBPM5.3 integration
            Houssem Salah Newbie

            Yes I did put process/Evaluation.bpmn in src/main/resources


            By the way, I have the same project in JPA1.0 and it work but when upgrade to JPA2.0 my database was updated and user are inserted in organizationalentity table

            but i have that message saying could not parse knowledge when loading Evaluation.bpmn into knowledge Builder.

             

            Other think I'm trying to debug KnowledgeBuilderImpl which contain implementation of "kbuilder.add(resource,type)" but I can't find source (I'm working with eclipse)

            have you any idea about how to do that?

            • 3. Re: Tomcat6 + Spring + JBPM5.3 integration
              Marcelo Zabalet Newbie

              Hi Houssem,

               

              the full stack trace of these could be off help. But it seems that the ResourceFactory could not find the resource then returning a null at some point.


              • 4. Re: Tomcat6 + Spring + JBPM5.3 integration
                Houssem Salah Newbie

                Sorry to respond too late.

                Application-context.xml (Spring)

                <context:annotation-config />
                <tx:annotation-driven />

                 

                <bean:bean id="jbpmEmf"
                class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

                 

                <bean:property name="persistenceUnitName" value="org-jbpm-persistence-jpa" />
                </bean:bean>

                 

                <bean:bean id="jbpmTxManager"
                class="org.springframework.orm.jpa.JpaTransactionManager">
                <bean:property name="entityManagerFactory" ref="jbpmEmf" />
                </bean:bean>

                 

                <bean:bean id="jbpTaskmEmf"
                class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                <bean:property name="persistenceUnitName" value="org-jbpm-task" />
                </bean:bean>

                 

                <bean:bean id="jbpmTaskTxManager"
                class="org.springframework.orm.jpa.JpaTransactionManager">
                <bean:property name="entityManagerFactory" ref="jbpTaskmEmf" />
                </bean:bean>
                <drools:grid-node id="node1"/>
                <drools:kbase id="kbase1" node="node1">

                 

                  <drools:resources>

                 

                    <drools:resource type="BPMN2" source="classpath:Evaluation.bpmn"/>

                 

                  </drools:resources>

                 

                </drools:kbase>

                 

                 

                 

                <drools:ksession id="ksession1" type="stateful" kbase="kbase1" node="node1">

                 

                  <drools:configuration>

                 

                    <drools:jpa-persistence>

                 

                      <drools:transaction-manager ref="jbpmTxManager"/>

                 

                      <drools:entity-manager-factory ref="jbpmEmf"/>

                 

                    </drools:jpa-persistence>

                 

                  </drools:configuration>

                 

                </drools:ksession>

                 

                 

                org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kbase1': Invocation of init method failed; nested exception is java.lang.RuntimeException: ProcessLoadError: unable to parse xml : Exception class java.lang.NullPointerException : null

                 

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

                    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)

                    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)

                    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)

                    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)

                    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)

                    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)

                    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)

                    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)

                    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)

                    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)

                    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)

                    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)

                    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)

                    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)

                    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

                    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)

                    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)

                    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)

                    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)

                    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)

                    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)

                    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)

                    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)

                    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)

                    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)

                    at org.apache.catalina.core.StandardService.start(StandardService.java:525)

                    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)

                    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                    at java.lang.reflect.Method.invoke(Method.java:601)

                    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

                    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

                Caused by: java.lang.RuntimeException: ProcessLoadError: unable to parse xml : Exception class java.lang.NullPointerException : null

                 

                    at org.drools.container.spring.beans.KnowledgeBaseBeanFactory.afterPropertiesSet(KnowledgeBaseBeanFactory.java:121)

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)

                    ... 36 more