1 2 Previous Next 28 Replies Latest reply on Aug 4, 2008 4:45 AM by Kevin Conner

    scoped class loading and jbpm.esb

    Jarkko Lietolahti Novice

      Hello,
      When deploying .esb-archive with scoped class loading I noticed that it isn't always working very well with JBPM, instead you get ugly ClassCastException.

      In the example below TestEsbAction.process is called from JBPM process using org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler

      java.lang.ClassCastException: CustomerType cannot be cast to CustomerType
       at MessageUtil.getCustomerFromMessage(MessageUtil.java:26)
       at TestEsbAction.process(PerustaAsiakas.java:334)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
       at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:316)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:530)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
       at java.lang.Thread.run(Thread.java:619)
      


      CustomerType is inside JAR-file which is in the root of the deployed esb-archive.
      If I turn the scoped class loading off this works, but that's something that cannot be done, as we want to be able to have different versions of same classes in other esb deployments).

      This gets even more uglier if there's a CustomerType available from non-scoped classloader. If this the case then jbpm.esb will use the class available from the "global" classloader and you get another ClassCastException inside the JBPM process either at or (there's some confusing documentation about the element names) when doing the mappings from bpm to esb.

      I think jbpm.esb should use the classloader of the ESB service where the jbpm call initiated. Do you think this would be possible to do? Or am I totally on the wrong track here..












        • 1. Re: scoped class loading and jbpm.esb
          Jarkko Lietolahti Novice

          Oh yes, I'm using InVM listener.

          [ActionProcessingPipeline] Unexpected exception caught while processing the action pipeline: header: [ To: InVMEpr [ PortReference < <wsa:Address invm://6f726465727375626d69744f7264657254544d6953657276696365?false#10000/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/invm/> > ] ReplyTo: EPR: PortReference < <wsa:Address logical:JBossESB-Internal#JBpmCallbackService/>, <wsa:ReferenceProperties jbossesb:esbToBpmVars : />, <wsa:ReferenceProperties jbossesb:jbpmTokenId : 72/>, <wsa:ReferenceProperties jbossesb:jbpmNodeId : 29/>, <wsa:ReferenceProperties jbossesb:jbpmProcessInstId : 72/>, <wsa:ReferenceProperties jbossesb:jbpmProcessNodeVersionCounter29_72 : 0/> > ]

          Also, I'm currently unable to get the 2nd ClassCastException to happen again (in the esbtojbpm mapping)

          • 2. Re: scoped class loading and jbpm.esb
            Jarkko Lietolahti Novice

            The problem is hit only when using InVM listener. With jms-listener my example works both with scoped and non -scoped classloaders..

            I just wished that I wouldn't have to configure so many JMS queues all the time with InVM ;(

            • 3. Re: scoped class loading and jbpm.esb
              Kevin Conner Master

              I have recently logged two issues against the jBPM classloading, https://jira.jboss.org/jira/browse/SOA-635 and https://jira.jboss.org/jira/browse/SOA-633

              This issue appears to be with the InVM code though, from what you are saying. I'll take a quick look and see what is happening.

              • 4. Re: scoped class loading and jbpm.esb
                Kevin Conner Master

                The InVM code looks fine to me, can you create a test case so that we can see what is going on?

                • 5. Re: scoped class loading and jbpm.esb
                  Tom Fennelly Master

                  This sounds like a pass-by-reference issue. By default, the InVM transport passes reference, so if you have your deployments scoped, your going to get ClassCastExceptions (see JBESB-1807). This issue was addressed, but it looks to me as though there may still be an issue (or issues).

                  • 6. Re: scoped class loading and jbpm.esb
                    Kevin Conner Master

                    That would make sense, especially if the jBPM process has a separate copy of the classes. The serialisation within the JMS processing would handle this.

                    • 7. Re: scoped class loading and jbpm.esb
                      Kevin Conner Master

                      Tom and I have had a look through the code and there are a couple of issues with the current 'pass by value' implementation.

                      Tom has raised the following jiras and we are putting them into the upcoming release.

                      https://jira.jboss.org/jira/browse/JBESB-1892 and https://jira.jboss.org/jira/browse/JBESB-1893

                      • 8. Re: scoped class loading and jbpm.esb
                        Tom Fennelly Master

                        These issues are fixed and checked into SVN trunk. So, you can try the fixes from source, or just wait for the 4.4 release. Would be nice if you could validate the fix for us!

                        • 10. Re: scoped class loading and jbpm.esb
                          Tom Fennelly Master

                          Check the programmers guide on this re message passing "by reference" or "by value" (just checked into SVN). You should turn on pass by value.

                          • 11. Re: scoped class loading and jbpm.esb
                            Kevin Conner Master

                            Please bear in mind the jBPM/SOA issues mentioned earlier, these could also cause issues in scoped deployments.

                            • 12. Re: scoped class loading and jbpm.esb
                              Jarkko Lietolahti Novice

                              While I was working with the SVN I made a quick patch which deploys jboss esb to a directory named "esb" in the deploy directory. I like this much more rather than "polluting" the deploy directory directly ;) This patch also fixes some artifacts (slsb.esb was one) not being undeployed.

                              jarkko@gandalf:~/esb/src/trunk/product/install$ svn diff
                              Index: build.xml
                              ===================================================================
                              --- build.xml (revision 21315)
                              +++ build.xml (working copy)
                              @@ -10,6 +10,8 @@



                              +
                              +



                              @@ -102,89 +104,98 @@


                              <!-- jbossesb.sar -->
                              -
                              +



                              <!-- jbossesb.esb -->
                              -
                              +



                              <!-- jbpm.esb -->
                              -
                              +



                              <!-- jbrules.esb -->
                              -
                              +



                              <!-- smooks.esb -->
                              -
                              +



                              <!-- spring.esb -->
                              -
                              +



                              <!-- soap.esb -->
                              -
                              +



                              - <!-- slsb.esb -->
                              -
                              - <fileset dir="${org.jboss.esb.dist.lib}/slsb.esb"
                              - excludes="${messaging.excludes}"/>
                              -
                              + <!-- slsb.esb -->
                              +
                              + <fileset dir="${org.jboss.esb.dist.lib}/slsb.esb"
                              + excludes="${messaging.excludes}"/>
                              +

                              <!-- soapui-client.sar -->
                              -
                              +



                              <!-- contracts app -->
                              -
                              +
                              <!-- config-editor app -->
                              -
                              +


                              <!-- install h2 jar -->

                              -
                              + Patching JBPM




                              + Deploying management-esb



                              +





                              -
                              -
                              -
                              -
                              -
                              -
                              -
                              -
                              -
                              -
                              -
                              + Undeploying JBoss ESB
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +
                              +


                              <property name="org.jboss.esb.tomcat.55lib"

                              • 13. Re: scoped class loading and jbpm.esb
                                Jarkko Lietolahti Novice

                                Yes, I known, no patches on the forums, but here go anyways ;)

                                Index: build.xml
                                ===================================================================
                                --- build.xml (revision 21315)
                                +++ build.xml (working copy)
                                @@ -10,6 +10,8 @@
                                 <property name="server.dir" value="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}"/>
                                 <property name="conf.dir" value="${server.dir}/conf"/>
                                 <property name="deploy.dir" value="${server.dir}/deploy"/>
                                + <property name="esb.deploy.dir" value="${deploy.dir}/esb"/>
                                +
                                 <property name="server.lib.dir" value="${server.dir}/lib"/>
                                 <property name="hadeploy.dir" value="${server.dir}/deploy-hasingleton"/>
                                
                                @@ -102,89 +104,98 @@
                                
                                 <target name="internal.deploy" depends="check.deploy.props, dependencies, jms.config" description="Deploys Internal Services to the server">
                                 <!-- jbossesb.sar -->
                                - <copy todir="${deploy.dir}/jbossesb.sar">
                                + <copy todir="${esb.deploy.dir}/jbossesb.sar">
                                 <fileset dir="${org.jboss.esb.dist.lib}/jbossesb.sar"/>
                                 </copy>
                                
                                 <!-- jbossesb.esb -->
                                - <copy todir="${deploy.dir}/jbossesb.esb">
                                + <copy todir="${esb.deploy.dir}/jbossesb.esb">
                                 <fileset dir="${org.jboss.esb.dist.lib}/jbossesb.esb"
                                 excludes="${messaging.excludes}"/>
                                 </copy>
                                
                                 <!-- jbpm.esb -->
                                - <copy todir="${deploy.dir}/jbpm.esb">
                                + <copy todir="${esb.deploy.dir}/jbpm.esb">
                                 <fileset dir="${org.jboss.esb.dist.lib}/jbpm.esb"
                                 excludes="${messaging.excludes}"/>
                                 </copy>
                                
                                 <!-- jbrules.esb -->
                                - <copy todir="${deploy.dir}/jbrules.esb">
                                + <copy todir="${esb.deploy.dir}/jbrules.esb">
                                 <fileset dir="${org.jboss.esb.dist.lib}/jbrules.esb"
                                 excludes="${messaging.excludes}"/>
                                 </copy>
                                
                                 <!-- smooks.esb -->
                                - <copy todir="${deploy.dir}/smooks.esb">
                                + <copy todir="${esb.deploy.dir}/smooks.esb">
                                 <fileset dir="${org.jboss.esb.dist.lib}/smooks.esb"
                                 excludes="${messaging.excludes}"/>
                                 </copy>
                                
                                 <!-- spring.esb -->
                                - <copy todir="${deploy.dir}/spring.esb">
                                + <copy todir="${esb.deploy.dir}/spring.esb">
                                 <fileset dir="${org.jboss.esb.dist.lib}/spring.esb"
                                 excludes="${messaging.excludes}"/>
                                 </copy>
                                
                                 <!-- soap.esb -->
                                - <copy todir="${deploy.dir}/soap.esb">
                                + <copy todir="${esb.deploy.dir}/soap.esb">
                                 <fileset dir="${org.jboss.esb.dist.lib}/soap.esb"
                                 excludes="${messaging.excludes}"/>
                                 </copy>
                                
                                - <!-- slsb.esb -->
                                - <copy todir="${deploy.dir}/slsb.esb">
                                - <fileset dir="${org.jboss.esb.dist.lib}/slsb.esb"
                                - excludes="${messaging.excludes}"/>
                                - </copy>
                                + <!-- slsb.esb -->
                                + <copy todir="${esb.deploy.dir}/slsb.esb">
                                + <fileset dir="${org.jboss.esb.dist.lib}/slsb.esb"
                                + excludes="${messaging.excludes}"/>
                                + </copy>
                                
                                 <!-- soapui-client.sar -->
                                - <copy todir="${deploy.dir}/soapui-client.sar">
                                + <copy todir="${esb.deploy.dir}/soapui-client.sar">
                                 <fileset dir="${org.jboss.esb.dist.lib}/soapui-client.sar" excludes="${messaging.excludes}"/>
                                 </copy>
                                
                                 <!-- contracts app -->
                                - <copy file="${org.jboss.esb.dist}/tools/console/console/jboss-esb-console.ear/contract.war" todir="${deploy.dir}" />
                                + <copy file="${org.jboss.esb.dist}/tools/console/console/jboss-esb-console.ear/contract.war" todir="${esb.deploy.dir}" />
                                 <!-- config-editor app -->
                                - <copy file="${org.jboss.esb.dist}/tools/configeditor/dist/jbossesb-config-editor.war" todir="${deploy.dir}" />
                                + <copy file="${org.jboss.esb.dist}/tools/configeditor/dist/jbossesb-config-editor.war" todir="${esb.deploy.dir}" />
                                 <copy file="${org.jboss.esb.dist}/tools/configeditor/resources/action-templates.xml" todir="${conf.dir}" />
                                
                                 <!-- install h2 jar -->
                                 <copy file="${org.jboss.esb.dist.lib}/h2-1.0.68.jar" todir="${server.lib.dir}"/>
                                -
                                + <echo>Patching JBPM</echo>
                                 <ant dir="jbpm-patch" target="replace">
                                 <property name="org.jboss.esb.server.home" value="${org.jboss.esb.server.home}"/>
                                 <property name="org.jboss.esb.server.config" value="${org.jboss.esb.server.config}"/>
                                 </ant>
                                + <echo>Deploying management-esb</echo>
                                 <ant dir="${product.dir}/tools/console/management-esb" target="deploy">
                                 <property name="org.jboss.esb.server.home" value="${org.jboss.esb.server.home}"/>
                                 <property name="org.jboss.esb.server.config" value="${org.jboss.esb.server.config}"/>
                                + <property name="deploy.dir" value="${esb.deploy.dir}"/>
                                 </ant>
                                
                                 </target>
                                
                                 <target name="undeploy" depends="check.deploy.props, undeploy.bindings" description="Undeploy ESB components.">
                                - <delete dir="${deploy.dir}/jbossesb.sar" />
                                - <delete dir="${deploy.dir}/jbossesb.esb" />
                                - <delete dir="${deploy.dir}/jbpm.esb" />
                                - <delete dir="${deploy.dir}/jbrules.esb" />
                                - <delete dir="${deploy.dir}/smooks.esb" />
                                - <delete dir="${deploy.dir}/spring.esb" />
                                - <delete dir="${deploy.dir}/soap.esb" />
                                - <delete dir="${deploy.dir}/soapui-client.sar" />
                                - <delete dir="${deploy.dir}/contract.war" />
                                - <delete dir="${deploy.dir}/jbossesb-config-editor.war" />
                                - <delete dir="${conf.dir}/action-templates.xml" />
                                + <echo>Undeploying JBoss ESB</echo>
                                + <delete dir="${esb.deploy.dir}/jbossesb.sar" />
                                + <delete dir="${esb.deploy.dir}/jbossesb.esb" />
                                + <delete dir="${esb.deploy.dir}/jbpm.esb" />
                                + <delete dir="${esb.deploy.dir}/jbrules.esb" />
                                + <delete dir="${esb.deploy.dir}/smooks.esb" />
                                + <delete dir="${esb.deploy.dir}/spring.esb" />
                                + <delete dir="${esb.deploy.dir}/soap.esb" />
                                + <delete dir="${esb.deploy.dir}/soapui-client.sar" />
                                + <delete dir="${esb.deploy.dir}/slsb.esb"/>
                                + <delete file="${esb.deploy.dir}/contract.war"/>
                                + <delete file="${esb.deploy.dir}/jbossesb-config-editor.war" />
                                + <delete dir="${conf.dir}/action-templates.xml" />
                                + <ant dir="${product.dir}/tools/console/management-esb" target="undeploy">
                                + <property name="org.jboss.esb.server.home" value="${org.jboss.esb.server.home}"/>
                                + <property name="org.jboss.esb.server.config" value="${org.jboss.esb.server.config}"/>
                                + <property name="deploy.dir" value="${esb.deploy.dir}"/>
                                + </ant>
                                 </target>
                                
                                 <property name="org.jboss.esb.tomcat.55lib"
                                
                                


                                • 14. Re: scoped class loading and jbpm.esb
                                  Jarkko Lietolahti Novice

                                   

                                  Index: tools/console/management-esb/build.xml
                                  ===================================================================
                                  --- tools/console/management-esb/build.xml (revision 21315)
                                  +++ tools/console/management-esb/build.xml (working copy)
                                  @@ -1,4 +1,4 @@
                                  -<?xml version="1.0"?>
                                  +<?xml version="1.0"?>
                                  
                                   <project name="management-esb" default="esb" basedir=".">
                                  
                                  @@ -15,7 +15,14 @@
                                   <!-- Default deploy property settings for the jbossesb-server -->
                                   <property name="org.jboss.esb.server.home" value="${product.dir}"/>
                                   <property name="org.jboss.esb.server.config" value="default"/>
                                  -
                                  + <property name="deploy.dir" value="deploy"/>
                                  +
                                  + <property name="server.dir" value="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}"/>
                                  + <property name="conf.dir" value="${server.dir}/conf"/>
                                  + <!-- <property name="deploy.dir" value="${server.dir}/deploy"/> -->
                                  + <property name="esb.deploy.dir" value="${server.dir}/deploy/esb"/>
                                  +
                                  +
                                   <target name="clean">
                                   <delete dir="${mgmt.esb.dir}/build"/>
                                   <ant dir="${console.dir}/management-web" target="clean"/>
                                  @@ -110,10 +117,15 @@
                                   <target name="copy-datasource" if="management.ds.available">
                                   <filter token="db.username" value="${db.username}"/>
                                   <filter token="db.password" value="${db.password}"/>
                                  - <copy file="${mgmt.esb.dir}/src/main/resources/${db}/management-ds.xml" todir="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/deploy" filtering="true" overwrite="true"/>
                                  + <copy file="${mgmt.esb.dir}/src/main/resources/${db}/management-ds.xml" todir="${esb.deploy.dir}" filtering="true" overwrite="true"/>
                                   </target>
                                  
                                   <target name="deploy" depends="esb,copy-datasource" description="Deploy the WAR">
                                  - <copy file="${mgmt.esb.dir}/build/management.esb" todir="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/deploy" overwrite="true"/>
                                  + <copy file="${mgmt.esb.dir}/build/management.esb" todir="${esb.deploy.dir}" overwrite="true"/>
                                   </target>
                                  +
                                  + <target name="undeploy">
                                  + <delete file="${esb.deploy.dir}/management.esb"/>
                                  + <delete file="${esb.deploy.dir}/management-ds.xml"/>
                                  + </target>
                                   </project>
                                  


                                  1 2 Previous Next