8 Replies Latest reply on Dec 4, 2006 7:36 PM by cocampo

    Exception instancing process

      Hello:

      Tom, Roland, Koen, I hope you jBPM guys can help me (anybody else's help is apreciated too, but as this seems to be a jBPM API problem...)

      Tools:

      JBoss 4.0.4GA, jBPM 3.1.2, jBPM DB is running on MySQL 5.0, JDK 1.5.08.


      I'm having an exception while instancing a process.

      Here is the error:

      15:01:42,171 ERROR [STDERR] java.lang.ClassCastException: org.jbpm.graph.def.ProcessDefinition
      15:01:42,171 ERROR [STDERR] at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:138)
      15:01:42,171 ERROR [STDERR] at mx.com.gigante.perfil.servlet.SubmitPdfServletOO.instanciarProceso(SubmitPdfServletOO.java:169)
      15:01:42,187 ERROR [STDERR] at mx.com.gigante.perfil.servlet.SubmitPdfServletOO.doPost(SubmitPdfServletOO.java:138)
      15:01:42,187 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      15:01:42,187 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      15:01:42,187 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      15:01:42,187 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      15:01:42,187 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      15:01:42,187 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      15:01:42,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      15:01:42,203 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      15:01:42,203 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      15:01:42,203 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      15:01:42,203 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      15:01:42,203 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      15:01:42,203 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      15:01:42,203 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      15:01:42,218 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      15:01:42,218 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      15:01:42,218 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      15:01:42,218 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      15:01:42,218 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      15:01:42,234 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
      15:01:42,234 ERROR [GraphSession] java.lang.ClassCastException: org.jbpm.graph.def.ProcessDefinition
      


      This is my process definition:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition xmlns="urn:jbpm.org:jpdl-3.1"
       name="proceso_perfil_proveedor">
       <start-state name="start">
       <transition name="" to="creacion contrato"></transition>
       </start-state>
       <task-node name="creacion contrato">
       <task name="crear_contrato"></task>
       <transition name="" to="1a revision contrato"></transition>
       </task-node>
       <task-node name="1a revision contrato">
       <task name="revision_contrato_1">
       <!-- dejar tiempo suficiente (5 segundos) para que quede almacenado el correo en la variable de tarea -->
       <timer
       name="envio_correo"
       duedate="5 seconds"
       repeat="7 days">
       <action
       class='mx.com.gigante.perfil.timers.GeneradorCorreos' />
       </timer>
       </task>
       <transition name="contrato_revisado"
       to="2a revision contrato">
       </transition>
       <transition name="contrato_cancelado"
       to="cancelacion contrato">
       </transition>
       <transition name="contrato_aprobado" to="impresion contrato"></transition>
       <transition name="contrato_rechazado"
       to="correccion contrato">
       </transition>
       </task-node>
       <task-node name="2a revision contrato">
       <task name="revision_contrato_2" >
       </task>
       <transition name="contrato_cancelado"
       to="cancelacion contrato">
       </transition>
       <transition name="contrato_rechazado"
       to="1a revision contrato">
       <action name="reenviar_contrato"></action>
       </transition>
       <transition name="contrato_aprobado" to="impresion contrato"></transition>
       </task-node>
       <task-node name="correccion contrato">
       <task name="correccion_contrato"></task>
       <transition name="contrato_corregido"
       to="1a revision contrato">
       </transition>
       </task-node>
       <task-node name="cancelacion contrato">
       <task name="cancelar_contrato"></task>
       <transition name="" to="end1"></transition>
       </task-node>
       <task-node name="impresion contrato">
       <task name="imprimir_contrato"></task>
       <transition name="" to="carga documento"></transition>
       </task-node>
       <task-node name="carga documento">
       <task name="cargar_documento"></task>
       <transition name="" to="end1"></transition>
       </task-node>
       <end-state name="end1"></end-state>
      </process-definition>
      


      And finally, here is the line where I'm getting the exception...
       ProcessInstance processInstance = jbpmContext.newProcessInstance("proceso_perfil_proveedor");
      




      <query name="GraphSession.findLatestProcessDefinitionQuery">
      <![CDATA[
      select pd
      from org.jbpm.graph.def.ProcessDefinition as pd
      where pd.name = :name
      order by pd.version desc
      ]]>
      </query>

      It looks OK to me, but as soon as the values retrieved try to be assigned to a ProcessDefinition-type variable, I got the "ClassCastException".
      I've been dealing with this problem for about a week, so any help would be mostly apreciated.

      It seems to be an error while executing the next query:


      Thanks in advance.



        • 1. Re: Exception instancing process
          kukeltje

          can it be the jbpmContext is loaded via e.g. the jbpm.sar and there is an additional ProcessDefinition on the classpath? I remember having had a similar issue (with a completely different product) where this was the case.

          • 2. Re: Exception instancing process

             

            "kukeltje" wrote:
            can it be the jbpmContext is loaded via e.g. the jbpm.sar and there is an additional ProcessDefinition on the classpath? I remember having had a similar issue (with a completely different product) where this was the case.


            Roland:

            I tried different approaches to solve this problem (with more or less the same result so far):

            1. Parse a XML file included in my JAR
            2. Parse a string
            3. First deploy the process, then deploy the application, then invoking the process.

            BTW, there is no other process deployed, only different versions of the same process. Is this what you were talking about?.

            Regards.

            • 3. Re: Exception instancing process
              kukeltje

              no, I meant a jar file on the classpath with the ProcessDefinition class in it, in addition to e.g. the sar file. So multiple PD classes on the classpath

              • 4. Re: Exception instancing process

                BTW Roland, I saw this post of yours, it's from 5 years ago (in the 'Design of JBoss jBPM' forum), you did seem to have a problem like mine, but there is no answer posted...

                http://www.jboss.com/index.html?module=bb&op=viewtopic&t=72126

                Regards.

                PS. I meant to post:


                It seems to be an error while executing the next query:

                 <query name="GraphSession.findLatestProcessDefinitionQuery">
                 <![CDATA[
                 select pd
                 from org.jbpm.graph.def.ProcessDefinition as pd
                 where pd.name = :name
                 order by pd.version desc
                 ]]>
                 </query>
                


                The query looks OK to me, but as soon as the values retrieved try to be assigned to a ProcessDefinition-type variable, I get the "ClassCastException".


                • 5. Re: Exception instancing process

                   

                  "kukeltje" wrote:
                  no, I meant a jar file on the classpath with the ProcessDefinition class in it, in addition to e.g. the sar file. So multiple PD classes on the classpath


                  My dear Roland:

                  If I could invite you a beer, I'll do it for sure. Thank you very much, that was indeed the problem.

                  Regards.

                  • 6. Re: Exception instancing process
                    kukeltje

                    you'll get the chance if I ever come to mexico again. Where did you say you live? Playa del Carmen? ;-)

                    • 7. Re: Exception instancing process
                      kukeltje

                      Btw, you made a very stupid, unforgiven error.......my name is Ronald, not Roland ;-)

                      • 8. Re: Exception instancing process

                         

                        "kukeltje" wrote:
                        you'll get the chance if I ever come to mexico again. Where did you say you live? Playa del Carmen? ;-)


                        Not even close, Mexico City, but if you ever came we can manage to visit Acapulco, is that good enough?

                        BTW, I was pretty sure I read Roland all this time; didn't you change your name in all the messages posted in the JBoss forums????? I'm starting to suspect it was this way...

                        Regards.

                        PS. Sorry RONALD =)