1 2 Previous Next 21 Replies Latest reply on Jul 6, 2010 12:37 PM by swiderski.maciej

    Process Variables made by Java cannot be deserialized

    gerardons

      Hi All,

       

      I have problems understanding why this little process doesn't work. Especially why the variable cannot be deserialized.

       

      I'm using jBoss-5.0.0.GA and jBPM-4.3.

      But first of all the process:

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <process name="TaskformTest" xmlns="http://jbpm.org/4.3/jpdl">

          <start g="72,104,48,48" name="start">

              <transition to="Setting Variable" />

          </start>

       

          <java class="de.hpi.pois.firsttest.Application" g="151,102,92,52"

              method="createApplication" name="Setting Variable" var="application">

       

              <arg>

                  <string value="Gerardo,g@hpi.cu" />

              </arg>

              <transition to="Taskform" />

          </java>

       

          <task candidate-users="alex" form="de/hpi/pois/firsttest/taskformTest.ftl"

              g="249,160,92,52" name="Taskform">

              <transition to="wait" />

          </task>

       

          <state g="362,94,92,52" name="wait">

              <transition to="end" />

          </state>

       

          <end g="507,101,48,48" name="end" />

      </process>

       

      The class looks like this:

       

      package de.hpi.pois.firsttest;

       

      import java.io.Serializable;

       

      public class Application implements Serializable
      {
          private static final long serialVersionUID = 1L;
         
          public String name;
          public String email;
         
          public Application(){}
         
          public Application(String name, String email)
          {
              setName(name);
              setEmail(email);
          }
         
          public static Application createApplication(String entry)
          {
              String[] entryElements = entry.split(",");
             
              return new Application(entryElements[0], entryElements[1]);
          }
         
          public void setName(String name) {
              this.name = name;
          }

       

          public String getName() {
              return name;

          }

       

          public void setEmail(String email) {
              this.email = email;
          }

       

          public String getEmail() {
              return email;
          }
      }

       

      the taskformTest.flt looks like this:

       

      <html>
        <head>
          <style type="text/css">  
           ${CSS!".body {font-family:sans-serif;}"}
          </style>
        </head>
        <body>
         
          <form action="${form.action}" method="POST" enctype="multipart/form-data">
         
            <h3>Getting the name of the applicant</h3>
           
            <br/>
            <br/>

            Name of the applicant: ${application.name}
           
            <br/>
            <br/>

            <input type="submit" name="done" value="Done"/>

       

          </form>
        </body>
      </html>

       

      So what happens?

       

      I start a new process instance via jbpm-console. Afterwards I go to alex's Personal Tasks and open the taskform (taskformTest.ftl). Then the following error occurs. I cannot understand why the object application cannot be deserialized, although the class application implements Serializable. In DevGuide it is said that process variables can be used in freemarker as variables, but I don't think the problem lies there. The same error happen when I select the created process instance and then click on Instance Data.

       

      HTTP Status 500 -


      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      org.jboss.resteasy.spi.UnhandledException: org.jbpm.api.JbpmException: couldn't deserialize object
           org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:319)
           org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230)
           org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:206)
           org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:360)
           org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
           org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
           org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
           org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      root cause

      org.jbpm.api.JbpmException: couldn't deserialize object
           org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter.revert(SerializableToBytesConverter.java:79)
           org.jbpm.pvm.internal.type.Variable.getValue(Variable.java:105)
           org.jbpm.pvm.internal.type.variable.BlobVariable.getValue(BlobVariable.java:61)
           org.jbpm.pvm.internal.model.ScopeInstanceImpl.getVariable(ScopeInstanceImpl.java:192)
           org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:63)
           org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:36)
           org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
           org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.executeInNewTx(JtaTransactionInterceptor.java:87)
           org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:66)
           org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
           org.jbpm.pvm.internal.tx.JtaRetryInterceptor.executeWithRetry(JtaRetryInterceptor.java:52)
           org.jbpm.pvm.internal.tx.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:45)
           org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
           org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
           org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
           org.jbpm.pvm.internal.svc.ExecutionServiceImpl.getVariables(ExecutionServiceImpl.java:139)
           org.jbpm.integration.console.forms.TaskFormDispatcher.provideForm(TaskFormDispatcher.java:103)
           org.jbpm.integration.console.forms.FormDispatcherComposite.provideForm(FormDispatcherComposite.java:65)
           org.jboss.bpm.console.server.FormProcessingFacade.provideForm(FormProcessingFacade.java:203)
           org.jboss.bpm.console.server.FormProcessingFacade.renderTaskUI(FormProcessingFacade.java:125)
           sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           java.lang.reflect.Method.invoke(Method.java:597)
           org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
           org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
           org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
           org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
           org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
           org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
           org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
           org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
           org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
           org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      root cause

      java.lang.ClassNotFoundException: de.hpi.pois.firsttest.Application
           java.net.URLClassLoader$1.run(URLClassLoader.java:202)
           java.security.AccessController.doPrivileged(Native Method)
           java.net.URLClassLoader.findClass(URLClassLoader.java:190)
           java.lang.ClassLoader.loadClass(ClassLoader.java:307)
           sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
           java.lang.ClassLoader.loadClass(ClassLoader.java:248)
           java.lang.Class.forName0(Native Method)
           java.lang.Class.forName(Class.java:247)
           org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:276)
           org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1099)
           org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:735)
           org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:378)
           java.lang.ClassLoader.loadClass(ClassLoader.java:248)
           java.lang.Class.forName0(Native Method)
           java.lang.Class.forName(Class.java:247)
           java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
           java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
           java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
           java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
           java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
           java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
           org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter.revert(SerializableToBytesConverter.java:69)
           org.jbpm.pvm.internal.type.Variable.getValue(Variable.java:105)
           org.jbpm.pvm.internal.type.variable.BlobVariable.getValue(BlobVariable.java:61)
           org.jbpm.pvm.internal.model.ScopeInstanceImpl.getVariable(ScopeInstanceImpl.java:192)
           org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:63)
           org.jbpm.pvm.internal.cmd.GetExecutionVariablesCmd.execute(GetExecutionVariablesCmd.java:36)
           org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
           org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.executeInNewTx(JtaTransactionInterceptor.java:87)
           org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:66)
           org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
           org.jbpm.pvm.internal.tx.JtaRetryInterceptor.executeWithRetry(JtaRetryInterceptor.java:52)
           org.jbpm.pvm.internal.tx.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:45)
           org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
           org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
           org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
           org.jbpm.pvm.internal.svc.ExecutionServiceImpl.getVariables(ExecutionServiceImpl.java:139)
           org.jbpm.integration.console.forms.TaskFormDispatcher.provideForm(TaskFormDispatcher.java:103)
           org.jbpm.integration.console.forms.FormDispatcherComposite.provideForm(FormDispatcherComposite.java:65)
           org.jboss.bpm.console.server.FormProcessingFacade.provideForm(FormProcessingFacade.java:203)
           org.jboss.bpm.console.server.FormProcessingFacade.renderTaskUI(FormProcessingFacade.java:125)
           sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           java.lang.reflect.Method.invoke(Method.java:597)
           org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
           org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
           org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
           org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
           org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
           org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
           org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
           org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
           org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
           org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      note The full stack trace of the root cause is available in the JBoss Web/2.1.1.GA logs.


       

      I hope you got an impression of my problem. What I've done wrong? I would very much appreciate if you could help me.

       

      Greetings,

       

      Gerardo

        • 1. Re: Process Variables made by Java cannot be deserialized
          rebody

          Hi Gerado,

            There is a ClassNotFoundException, it means that jBPM4 couldn't find your class in classpath.  Could you tell me how you deploy the *.jpdl.xml and class file?

           

            cheers.

          • 2. Re: Process Variables made by Java cannot be deserialized
            gerardons

            Hello Huisheng,

             

            thanks for your answer.

            I installed jBPM via demo.setup.jboss.

             

            In my project I'm using the create.and.deploy.pois target of the following build.xml. I copied the build.xml from the example project. But I had to modify it a little bit, because the original build.xml creates an example.bar which contains *.java - Files and not *.class - Files. So I changed it and my pois.bar contains *.class - Files. 

             

            <?xml version="1.0" encoding="UTF-8"?>

             

            <project name="jbpm.pois">

             

                <!-- DEVELOPER SPECIFIC CONFIGURATIONS -->

                <property file="${user.home}/.jbpm4/build.properties" />

             

                <!-- DEFAULT PROPERTY VALUES -->

                <property name="database" value="hsqldb" />

                <property name="jbpm.parent.dir" value="../.." />

                <property name="jbpm.version" value="4.3" />

                <property name="jboss.version" value="5.0.0.GA" />

                <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" />

             

                <!-- JDBC PROPERTIES -->

                <property file="${user.home}/.jbpm4/jdbc/${database}.properties" />

                <property file="${jbpm.home}/db/jdbc/${database}.properties" />

             

                <!-- ### LOG PROPERTIES ################################################# -->

                <target name="log.properties">

                    <echo message="database: ${database}" />

                    <echo message="jdbc.driver........ ${jdbc.driver}" />

                    <echo message="jdbc.url........... ${jdbc.url}" />

                    <echo message="jdbc.username...... ${jdbc.username}" />

                    <echo message="jbpm.version....... ${jbpm.version}" />

                    <echo message="jbpm.home.......... ${jbpm.home}" />

                </target>

             

                <target name="jbpm.libs.path">

                    <path id="jbpm.libs.incl.dependencies">

                        <pathelement location="${jbpm.home}/pois/target/classes" />

                        <fileset dir="${jbpm.home}">

                            <include name="jbpm.jar" />

                        </fileset>

                        <fileset dir="${jbpm.home}/lib" />

                    </path>

                </target>

             

                <!-- ### DEPLOY EXAMPLE BUSINESS ARCHIVES ############################### -->

                <target name="create.and.deploy.pois"

                          depends="jbpm.libs.path, pois.jar">

                    <mkdir dir="${jbpm.home}/pois/target" />

                    <copy file="${jbpm.home}/install/src/cfg/hibernate/jdbc/${database}.hibernate.cfg.xml"

                            tofile="${jbpm.home}/pois/target/classes/jbpm.hibernate.cfg.xml"

                          overwrite="true">

                        <filterset filtersfile="${jbpm.home}/install/jdbc/${database}.properties" />

                    </copy>

                    <jar destfile="${jbpm.home}/pois/target/pois.bar" >

                        <fileset dir="${jbpm.home}/pois/target/classes">

                            <exclude name="jbpm.cfg.xml" />

                            <exclude name="jbpm.hibernate.cfg.xml" />

                            <exclude name="jbpm.mail.properties" />

                            <exclude name="jbpm.mail.templates.examples.xml" />

                            <exclude name="logging.properties" />

                            <exclude name="de/hpi/pois/bewerbungsverfahren/bewerbungsverfahren.jpdl.xml" />

                            <exclude name="de/hpi/pois/bewerbungsverfahren/Bewerberbewertung.jpdl.xml" />

             

                            <exclude name="de/hpi/pois/firsttest/timing.jpdl.xml" />

                        </fileset>

                    </jar>

             

                    <!-- <jar destfile="${jbpm.home}/pois/target/pois.bar">

                        <fileset dir="${jbpm.home}/pois/src">

                            <exclude name="jbpm.cfg.xml" />

                            <exclude name="jbpm.hibernate.cfg.xml" />

                            <exclude name="jbpm.mail.properties" />

                            <exclude name="jbpm.mail.templates.examples.xml" />

                            <exclude name="logging.properties" />

             

                            <exclude name="de/hpi/pois/bewerbungsverfahren/bewerbungsverfahren.jpdl.xml" />

                            <exclude name="de/hpi/pois/bewerbungsverfahren/Bewerberbewertung.jpdl.xml" />

             

                            <exclude name="de/hpi/pois/firsttest/timing.jpdl.xml" />

                        </fileset>

                    </jar> -->

             

                    <taskdef name="jbpm-deploy" classname="org.jbpm.pvm.internal.ant.JbpmDeployTask" classpathref="jbpm.libs.incl.dependencies" />

                    <jbpm-deploy file="${jbpm.home}/pois/target/pois.bar" />

                </target>

             

                <target name="pois.jar" depends="jbpm.libs.path">

                    <mkdir dir="${jbpm.home}/pois/target/classes" />

                    <javac srcdir="${jbpm.home}/pois/src"

                       destdir="${jbpm.home}/pois/target/classes"

                             source="1.5"

                       classpathref="jbpm.libs.incl.dependencies" />

                    <copy todir="${jbpm.home}/pois/target/classes">

                        <fileset dir="${jbpm.home}/pois/src">

                            <exclude name="**/*.java" />

                        </fileset>

                    </copy>

                    <jar destfile="${jbpm.home}/pois/target/pois.jar" >

                        <fileset dir="${jbpm.home}/pois/target/classes">

                            <include name="**/*.class" />

                        </fileset>

                    </jar>

                </target>

             

            </project>

             

            Thanks again for your help.

             

            Greetings,

             

            Gerardo

            • 3. Re: Process Variables made by Java cannot be deserialized
              gerardons

              But it is a little bit strange that jBPM throws this exception when there is an access to the process variable application. The error doesn't occur when the java activity is running. The Java task doesn't have any problems. But if the classpath is wrong, the problem should occur in the java activity and jBPM shouldn't come to the task. Am I thinking right? So I would say that the class path is ok, but obiviously not. Any ideas?

              • 4. Re: Process Variables made by Java cannot be deserialized
                rebody

                Hi Gerado,

                  It seems as jBPM 4 could handle your class successfully, but when the console want to display a task form to user, it try to get variable form the process, then the exception occured.  So I think it is a issue of console.

                • 5. Re: Process Variables made by Java cannot be deserialized
                  swiderski.maciej

                  Hi,

                   

                  I looked into this issue a bit and to it looks like problem is when variable is deserialized when invoked from different class loader (for instance BPM console). Due to the nature of the ObjectInputStream classes are looked up using local class loader and there is no checks towards DeploymentClassLoader (resources stored in db).

                  It works fine for user code (such as activities and event listeners) because these type of items are DeploymentClassLoader aware.

                   

                  I made small checks on it with sample fixes and it seems to work after making that deserialization aware of resouces stored in db. Need to work on it  a bit more to verify if everything works properly.

                   

                  Do you know if there is any jira issue for that?!

                   

                  Cheers,

                  Maciej

                  • 6. Re: Process Variables made by Java cannot be deserialized
                    rebody

                    Hi Maciej,

                      I find thrree similar issues, all of them was for jBPM 3, and alejandro said two of them had been sovled.

                     

                    https://jira.jboss.org/jira/browse/JBPM-1024

                    https://jira.jboss.org/jira/browse/JBPM-1914

                    https://jira.jboss.org/jira/browse/JBPM-2692

                     

                    Should we create a new issue for jBPM 4?

                    • 7. Re: Process Variables made by Java cannot be deserialized
                      swiderski.maciej

                      Hi,

                       

                      it seems like issue for 4.x is needed since code base is completely different compared to 3.x.

                       

                      If you create an issue I could supply a patch within few days (most likely during weekend).

                       

                      Cheers,

                      Maciej

                      • 8. Re: Process Variables made by Java cannot be deserialized
                        rebody

                        Hi Maciej,

                          Here is the issue.

                         

                          https://jira.jboss.org/jira/browse/JBPM-2853

                        • 9. Re: Process Variables made by Java cannot be deserialized
                          rebody

                          I am afraid of I make a mistake.  There is already an issue for this bug.

                           

                            https://jira.jboss.org/jira/browse/JBPM-2703

                           

                            I think my issue should be marked as duplicated.

                           

                            https://jira.jboss.org/jira/browse/JBPM-2853

                          • 10. Re: Process Variables made by Java cannot be deserialized
                            swiderski.maciej

                            Hi,

                             

                            this is exactly the issue. I will post the fix for it soon.

                             

                            Thanks for look up of the issue.

                             

                            Cheers,

                            Maciej

                            • 11. Re: Process Variables made by Java cannot be deserialized
                              gerardons

                              Hi Marciej and Huisheng,

                               

                              thank you very much for dealing with and fixing that issue.

                               

                              I would like to know when the fix is available (in the next release or something else) and if there is any problem installing the fix.

                               

                              And again thanks for the help.

                               

                              Greetings,

                               

                              Gerardo

                              • 12. Re: Process Variables made by Java cannot be deserialized
                                swiderski.maciej

                                Hi,

                                 

                                no problem Gerardo, this is why we are here, to share our experience, knowledge and most important t help each other.

                                 

                                hopefully it will be included in 4.4 release. Just stick to jira issue to get latest information about it.

                                 

                                Cheers,

                                Maciej

                                • 13. Re: Process Variables made by Java cannot be deserialized
                                  gerardons

                                  Hi Marciej,

                                   

                                  thanks again for the fix. You said that the fix will be available in jbpm-4.4. Do you know when is this version released? There some threads about this question, but none of them says something about the date of the release.

                                   

                                  So my question is if there is any possibility to get this fix now?

                                   

                                  Greetings,

                                   

                                  Gerardo

                                  • 14. Re: Process Variables made by Java cannot be deserialized
                                    swiderski.maciej

                                    Hi,

                                     

                                    I said that hopefully it will be included in next release.

                                    I don't know if there is any date set for 4.4 release but stay tuned for such information. It should come up quite soon, I suppose.

                                     

                                    You can always get latest trunk version from SVN, then apply patch (it is already in jira) and build distribution.

                                     

                                    Cheers,

                                    Maciej

                                    1 2 Previous Next