3 Replies Latest reply on Aug 18, 2006 4:58 PM by Alejandro Guizar

    DelegationException. ClassCastException..

    rafael diaz Newbie

      Hi
      I have some processes defined and i have an object that is created in the first node and seted as a process variable using setVariable method
      The problem is when I try to load the object in the next node i get an DelegationException caused by ClassCastException
      My object class is:

      public class ContentPackage implements Serializable{
      
       private static final long serialVersionUID = 2175042348064562851L;
       static Logger logger = Logger.getLogger(ContentPackage.class);
      
       private transient Document docPublish;
       //private List instancesContentManagement;
      
      
       public ContentPackage(String idContent, String type){
      
       docPublish = XMLHelper.createDocument();
       Element root = (Element)docPublish.appendChild(docPublish.createElement("documentPublish"));
      
       Element header = docPublish.createElement("header");
       root.appendChild(header);
      
       Element idCont = docPublish.createElement("idContent");
       idCont.appendChild(docPublish.createTextNode(idContent));
       header.appendChild(idCont);
      
       Element contentType = docPublish.createElement("contentType");
       contentType.appendChild(docPublish.createTextNode(type));
       header.appendChild(contentType);
      
       Element date = docPublish.createElement("createdDate");
       date.appendChild(docPublish.createTextNode(ProjectUtil.dateFormat(new Date(), "dd-MM-yyyy HH:mm:ss.S")));
       header.appendChild(date);
      
       Element body = docPublish.createElement("body");
       root.appendChild(body);
      
       }
      
       public Document getDocPublish() {
       return docPublish;
       }
      
       public void setDocPublish(Document docPublish) {
       this.docPublish = docPublish;
       }
      }
      


      I thought that the problem was that the document (w3c) field was not serializable and i put the filed transient and defined wrtiteObject and readObject methods, but nothing.. the same error...

      ANY IDEA ?????

        • 1. Re: DelegationException. ClassCastException..
          Ronald van Kuijk Master

          PLEASE post a UNITTEST with embedded processdefinition to demonstrate the problem. I can drop that in my ide, run/debug it real quick then.

          • 2. Re: DelegationException. ClassCastException..
            rafael diaz Newbie

            The process definition

            <?xml version="1.0" encoding="UTF-8"?>
            
            <process-definition
             xmlns="urn:jbpm.org:jpdl-3.1" name="EventPublisherProcess">
             <start-state name="Inicar Proceso Evento">
             <task name="inicio">
             <controller>
             <variable name="id" access="read"></variable>
             </controller>
             </task>
             <transition name="" to="Extraer Evento"></transition>
             </start-state>
             <end-state name="Fin Publicacion Evento"></end-state>
             <node name="Extraer Evento">
             <action class="com.sinflash.handlers.events.ExtractEventHandler"></action>
             <transition name="" to="Transformar Evento"></transition>
             </node>
             <node name="Transformar Evento">
             <action class="com.sinflash.handlers.events.TransformEventHandler"></action>
             <transition name="" to="Enrutar Evento"></transition>
             </node>
             <node name="Enrutar Evento">
             <action class="com.sinflash.handlers.events.RouterEventHandler"></action>
             <transition name="" to="Publicar en Instancia"></transition>
             </node>
             <fork name="Publicar en Instancia">
             <transition name="vzla" to="Publicar Evento Venezuela"></transition>
             <transition name="pr" to="Publicar Evento Puerto Rico"></transition>
             </fork>
             <node name="Publicar Evento Venezuela">
             <transition name="" to="join1"></transition>
             </node>
             <node name="Publicar Evento Puerto Rico">
             <transition name="" to="join1"></transition>
             </node>
             <join name="join1">
             <transition name="" to="Fin Publicacion Evento"></transition>
             </join>
            </process-definition>
            



            The extractEventHandler
            ublic class ExtractEventHandler implements ActionHandler{
            
             private static final long serialVersionUID = 1L;
            
             //Colocar aqui la direccion del servlet que genera el XML del evento en DIRECTOR
             private final String xmlServletAddress = "http://192.168.0.174/SinFlash/ContentMgmt?eventID=";
            
             /**
             * Metodo que se llama cuando se ejecuta el Handler del proceso al cual pertenece
             */
             public void execute(ExecutionContext executionContext) throws Exception {
            
             String eventId = (String) executionContext.getContextInstance().getVariable("id");
             ContentPackage doc = new ContentPackage(eventId, "event");
             Document document = doc.getDocPublish();
            
            // Doing something with that Document
            
            doc.setDocPublish(document);
             executionContext.setVariable("contentPackage",doc);
             executionContext.leaveNode();
             }
            


            The contentPackage (the class i want to set as variable)
            public class ContentPackage implements Serializable{
            
             private static final long serialVersionUID = 2175042348064562851L;
             static Logger logger = Logger.getLogger(ContentPackage.class);
            
             private transient Document docPublish;
             //private List instancesContentManagement;
            
            
             public ContentPackage(String idContent, String type){
            
             docPublish = XMLHelper.createDocument();
             Element root = (Element)docPublish.appendChild(docPublish.createElement("documentPublish"));
            
             Element header = docPublish.createElement("header");
             root.appendChild(header);
            
             Element idCont = docPublish.createElement("idContent");
             idCont.appendChild(docPublish.createTextNode(idContent));
             header.appendChild(idCont);
            
             Element contentType = docPublish.createElement("contentType");
             contentType.appendChild(docPublish.createTextNode(type));
             header.appendChild(contentType);
            
             Element date = docPublish.createElement("createdDate");
             date.appendChild(docPublish.createTextNode(ProjectUtil.dateFormat(new Date(), "dd-MM-yyyy HH:mm:ss.S")));
             header.appendChild(date);
            
             Element body = docPublish.createElement("body");
             root.appendChild(body);
            
             }
            
             public Document getDocPublish() {
             return docPublish;
             }
            
             public void setDocPublish(Document docPublish) {
             this.docPublish = docPublish;
             }
            
            }
            
            


            The transformEventHandler

            
            public class TransformEventHandler implements ActionHandler{
            
             private static final long serialVersionUID = 1L;
            
             public void execute(ExecutionContext executionContext) throws Exception {
            
             System.out.println("================ TRANSFORM EVENT HANDLER ===================================");
             ContentPackage contentPackage = (ContentPackage)executionContext.getVariable("contentPackage");
             Document doc = contentPackage.getDocPublish();
            
             System.out.println("XML");
             System.out.println(XMLHelper.serializeDocument(doc));
             executionContext.leaveNode();
             }
            
            }
            
            
            


            The Exception

            
            11:13:07,608 INFO [STDOUT] OCURRIO UN ERROR..
            11:13:07,608 INFO [STDOUT] org.jbpm.graph.def.DelegationException
            11:13:07,623 INFO [STDOUT] at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:352)
            11:13:07,623 INFO [STDOUT] at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:346)
            11:13:07,623 INFO [STDOUT] at org.jbpm.graph.def.Node.execute(Node.java:333)
            11:13:07,623 INFO [STDOUT] at org.jbpm.graph.def.Node.enter(Node.java:316)
            11:13:07,639 INFO [STDOUT] at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
            11:13:07,639 INFO [STDOUT] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            11:13:07,639 INFO [STDOUT] at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
            11:13:07,655 INFO [STDOUT] at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$da47265b.enter(<generated>)
            11:13:07,655 INFO [STDOUT] at org.jbpm.graph.def.Transition.take(Transition.java:119)
            11:13:07,655 INFO [STDOUT] at org.jbpm.graph.def.Node.leave(Node.java:383)
            11:13:07,655 INFO [STDOUT] at org.jbpm.graph.node.StartState.leave(StartState.java:70)
            11:13:07,670 INFO [STDOUT] at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
            11:13:07,670 INFO [STDOUT] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            11:13:07,670 INFO [STDOUT] at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
            11:13:07,670 INFO [STDOUT] at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$da47265b.leave(<generated>)
            11:13:07,686 INFO [STDOUT] at org.jbpm.graph.exe.Token.signal(Token.java:174)
            11:13:07,686 INFO [STDOUT] at org.jbpm.graph.exe.Token.signal(Token.java:123)
            11:13:07,686 INFO [STDOUT] at com.sinflash.ws.SinflashPublisherImpl.startPublishProcess(SinflashPublisherImpl.java:33)
            11:13:07,686 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            11:13:07,702 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            11:13:07,702 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            11:13:07,702 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
            11:13:07,717 INFO [STDOUT] at org.jboss.webservice.server.InvokerProviderJSE.invokeServiceEndpoint(InvokerProviderJSE.java:154)
            11:13:07,717 INFO [STDOUT] at org.jboss.webservice.server.InvokerProvider.invokeMethod(InvokerProvider.java:305)
            11:13:07,717 INFO [STDOUT] at org.jboss.axis.providers.java.RPCProvider.invokeTarget(RPCProvider.java:176)
            11:13:07,717 INFO [STDOUT] at org.jboss.webservice.server.InvokerProviderJSE.invokeTarget(InvokerProviderJSE.java:93)
            11:13:07,733 INFO [STDOUT] at org.jboss.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:121)
            11:13:07,733 INFO [STDOUT] at org.jboss.axis.providers.java.JavaProvider.invoke(JavaProvider.java:358)
            11:13:07,733 INFO [STDOUT] at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
            11:13:07,748 INFO [STDOUT] at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
            11:13:07,748 INFO [STDOUT] at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
            11:13:07,748 INFO [STDOUT] at org.jboss.axis.handlers.soap.SOAPService.invoke(SOAPService.java:560)
            11:13:07,748 INFO [STDOUT] at org.jboss.webservice.server.ServerEngine.invokeInternal(ServerEngine.java:200)
            11:13:07,764 INFO [STDOUT] at org.jboss.webservice.server.ServerEngine.invoke(ServerEngine.java:89)
            11:13:07,764 INFO [STDOUT] at org.jboss.axis.transport.http.AxisServlet.doPost(AxisServlet.java:911)
            11:13:07,764 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            11:13:07,764 INFO [STDOUT] at org.jboss.axis.transport.http.AxisServletBase.service(AxisServletBase.java:370)
            11:13:07,780 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            11:13:07,780 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            11:13:07,780 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            11:13:07,795 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
            11:13:07,795 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            11:13:07,795 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            11:13:07,795 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            11:13:07,811 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            11:13:07,811 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
            11:13:07,811 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
            11:13:07,827 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
            11:13:07,827 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            11:13:07,827 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            11:13:07,827 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            11:13:07,842 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            11:13:07,842 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
            11:13:07,842 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
            11:13:07,842 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            11:13:07,858 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            11:13:07,858 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
            11:13:07,858 INFO [STDOUT] Caused by: org.jbpm.graph.def.DelegationException
            11:13:07,873 INFO [STDOUT] at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:352)
            11:13:07,873 INFO [STDOUT] at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:346)
            11:13:07,873 INFO [STDOUT] at org.jbpm.graph.def.Node.execute(Node.java:333)
            11:13:07,873 INFO [STDOUT] at org.jbpm.graph.def.Node.enter(Node.java:316)
            11:13:07,889 INFO [STDOUT] at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
            11:13:07,889 INFO [STDOUT] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            11:13:07,889 INFO [STDOUT] at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
            11:13:07,889 INFO [STDOUT] at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$da47265b.enter(<generated>)
            11:13:07,905 INFO [STDOUT] at org.jbpm.graph.def.Transition.take(Transition.java:119)
            11:13:07,905 INFO [STDOUT] at org.jbpm.graph.def.Node.leave(Node.java:383)
            11:13:07,905 INFO [STDOUT] at org.jbpm.graph.def.Node.leave(Node.java:347)
            11:13:07,905 INFO [STDOUT] at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:120)
            11:13:07,920 INFO [STDOUT] at com.sinflash.handlers.events.ExtractEventHandler.execute(ExtractEventHandler.java:84)
            11:13:07,920 INFO [STDOUT] at org.jbpm.graph.def.Action.execute(Action.java:123)
            11:13:07,920 INFO [STDOUT] at org.jbpm.graph.def.Action$$FastClassByCGLIB$$7876e90e.invoke(<generated>)
            11:13:07,936 INFO [STDOUT] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            11:13:07,936 INFO [STDOUT] at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
            11:13:07,936 INFO [STDOUT] at org.jbpm.graph.def.Action$$EnhancerByCGLIB$$da292a8f.execute(<generated>)
            11:13:07,936 INFO [STDOUT] at org.jbpm.graph.def.Node.execute(Node.java:328)
            11:13:07,952 INFO [STDOUT] ... 54 more
            11:13:07,952 INFO [STDOUT] Caused by: java.lang.ClassCastException: com.sinflash.cm.ContentPackage
            11:13:07,952 INFO [STDOUT] at com.sinflash.handlers.events.TransformEventHandler.execute(TransformEventHandler.java:17)
            11:13:07,967 INFO [STDOUT] at org.jbpm.graph.def.Action.execute(Action.java:123)
            11:13:07,967 INFO [STDOUT] at org.jbpm.graph.def.Action$$FastClassByCGLIB$$7876e90e.invoke(<generated>)
            11:13:07,967 INFO [STDOUT] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            11:13:07,967 INFO [STDOUT] at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
            11:13:07,983 INFO [STDOUT] at org.jbpm.graph.def.Action$$EnhancerByCGLIB$$da292a8f.execute(<generated>)
            11:13:07,983 INFO [STDOUT] at org.jbpm.graph.def.Node.execute(Node.java:328)
            11:13:07,983 INFO [STDOUT] ... 70 more
            


            • 3. Re: DelegationException. ClassCastException..
              Alejandro Guizar Master

              Rafael...
              ExtractEventHandler:

              Document document = doc.getDocPublish();
              executionContext.setVariable("contentPackage",doc);

              TransformEventHandler:
              ContentPackage contentPackage = (ContentPackage)executionContext.getVariable("contentPackage");

              Amigo, revisa tu código :)