Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
cannot be cast to org.jbpm.graph.def.ActionHandler Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • cannot be cast to org.jbpm.graph.def.ActionHandler

    Hi,

    I have a very simple handler that gets invoked when the timer fires.

    Handler code:
    Code:
    import org.jbpm.graph.def.ActionHandler;
    import org.jbpm.graph.exe.ExecutionContext;
    
    public class OrderLockHandler implements ActionHandler {
    
            private static final long serialVersionUID = 1L;
    
    	public void execute(ExecutionContext executionContext) throws Exception
    	{
                  System.out.println("Inside OrderLockHandler::execute()");
    	}
    }
    This handler is inside a jar. I don't really know what is the proper way to deploy jars to the jboss server, so I copy this jar to
    C:\jboss\jbpm-jpdl-3.2.3\server\server\jbpm\lib directory and start the server.

    I create an instance of the process and when the timer fires, I receive the following exception:

    Code:
    Caused by: java.lang.ClassCastException: com.primolow.auction.jbpm.handler.OrderLockHandler cannot be cast to org.jbpm.graph.def.ActionHandler
            at org.jbpm.graph.def.Action.execute(Action.java:121)
            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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
            at org.jbpm.graph.def.Action_$$_javassist_34.execute(Action_$$_javassist_34.java)
            at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:259)
    My only guess was to check that the version of jbpm-jpdl.jar in jboss is the same as the one I linked against in my handler jar. They were the same.

    Thanks for any help

  • #2
    In cases where you get class cast exceptions using ActionHandler
    or Action, you should try to use delegation instead of casting.

    For example:

    Code:
    Node node = new Node("x");
    Event event = new Event(Event.EVENTTYPE_x);
    Delegation delegation = new Delegation("x.ActionHander");
    Action action = new Action(delegation);
    event.addAction(action);
    node.addEvent(event);

    Comment

    Working...
    X