11 Replies Latest reply on Jul 11, 2009 10:56 AM by aguizar

    ProcessClassloader question

      Please bear with me if this is a duplicate post.

      I need a way to disable use of processclassloader for process execution
      Or any alternative approach to solve the below issue.

      The issue as i see it is that Processclassloader is assigned as the classloader in Thread executing the process and it simply fails with a throwable if the class looked for is not there in database. The calling code does not get a chance to recover from the exception(caller of that code is probably expecting ClassNotFoundException).
      I have run into a few issues because of above in JBPM 3.2.6SP1, The stacktrace always ends in NullpointerException in FileDefinition.getBytesFromDb.


      This is the error i got today... I am trying to invoke an EJB within actionhandler which has long(native) as input. When container is trying to serialize for the method call,the processclassloader is not able to locate the required class and fails with stack as below.

      Appreciate quick help on this one!!
      Thanks,
      Sarish


      Stack Trace

      12:43:44,023 ERROR [GraphElement] action threw exception: couldn't get value for file 'classes/long.class'
      org.jbpm.JbpmException: couldn't get value for file 'classes/long.class'
       at org.jbpm.file.def.FileDefinition.getBytes(FileDefinition.java:196)
       at org.jbpm.instantiation.ProcessClassLoader.findClass(ProcessClassLoader.java:116)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.jboss.ejb3.common.lang.SerializableMethod.getClassFromName(SerializableMethod.java:307)
       at org.jboss.ejb3.common.lang.SerializableMethod.toMethod(SerializableMethod.java:239)
       at org.jboss.ejb3.common.lang.SerializableMethod.toMethod(SerializableMethod.java:220)
       at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:236)
       at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
       at $Proxy249.getPermissionBySystemId(Unknown Source)
       at com.apple.ist.ps2.server.process.rules.RuleService.getEvents(RuleService.java:226)
       at com.apple.ist.ps2.server.process.jbpm.handler.DetermineEventsHandler.execute(DetermineEventsHandler.java:22)
       at org.jbpm.graph.def.Action.execute(Action.java:125)
       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:585)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
       at org.jbpm.graph.def.Action_$$_javassist_75.execute(Action_$$_javassist_75.java)
       at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:281)
       at org.jbpm.graph.def.Node.execute(Node.java:412)
       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:585)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
       at org.jbpm.graph.def.Node_$$_javassist_61.execute(Node_$$_javassist_61.java)
       at org.jbpm.job.ExecuteNodeJob.execute(ExecuteNodeJob.java:35)
       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:585)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
       at org.jbpm.job.Job_$$_javassist_66.execute(Job_$$_javassist_66.java)
       at org.jbpm.ejb.impl.ExecuteJobCommand.executeJob(ExecuteJobCommand.java:72)
       at org.jbpm.ejb.impl.ExecuteJobCommand.execute(ExecuteJobCommand.java:52)
       at org.jbpm.ejb.impl.CommandServiceBean.execute(CommandServiceBean.java:110)
       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:585)
       at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
       at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
       at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
       at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
       at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
       at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
       at org.jboss.ejb.Container.invoke(Container.java:1029)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:436)
       at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
       at $Proxy238.execute(Unknown Source)
       at org.jbpm.ejb.impl.CommandListenerBean.onMessage(CommandListenerBean.java:119)
       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:585)
       at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
       at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:513)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
       at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:115)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
       at org.jboss.ejb.plugins.RunAsSecurityInterceptor.process(RunAsSecurityInterceptor.java:133)
       at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:103)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
       at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:415)
       at org.jboss.ejb.Container.invoke(Container.java:1029)
       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:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
       at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
       at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
       at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.delivery(MessageEndpointInterceptor.java:249)
       at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.invoke(MessageEndpointInterceptor.java:128)
       at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
       at $Proxy246.onMessage(Unknown Source)
       at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:178)
       at org.jboss.jms.client.container.ClientConsumer.callOnMessageStatic(ClientConsumer.java:160)
       at org.jboss.jms.client.container.SessionAspect.handleRun(SessionAspect.java:831)
       at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect_z_handleRun_8818949.invoke(SessionAspect_z_handleRun_8818949.java)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
       at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.jms.client.delegate.ClientSessionDelegate.run(ClientSessionDelegate.java)
       at org.jboss.jms.client.JBossSession.run(JBossSession.java:199)
       at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:234)
       at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:213)
       at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:613)
      Caused by: java.lang.NullPointerException
       at org.jbpm.file.def.FileDefinition.getBytesFromDb(FileDefinition.java:213)
       at org.jbpm.file.def.FileDefinition.getBytes(FileDefinition.java:193)
       ... 114 more


        • 1. Re: ProcessClassloader question
          kukeltje

          "long" as a class???

          • 2. Re: ProcessClassloader question

            Hi,
            thanks for your response..
            I did not understand, was that a question for me? or surprised at the stacktrace?
            This was the method i was trying to invoke.

            public List<PsRole> getRoleBySystemId(long systemid);



            • 3. Re: ProcessClassloader question
              kukeltje

              long is not a class but a primitive datatype. So therefore I was surprised to see that. Because of the very limited amount of information you gave, I thought you were using 'long' as an actionhandler or somthing. That would be really weird, but that is what the stacktrace suggests.

              And even now you give way to little info. The getRolesBySystemId is not a method in jBPM 3 (at least my search dit not return anything) So it is hard for us to help

              • 4. Re: ProcessClassloader question
                swatis

                I guess the action handler class is referring classes which are not present in classpath. but surprised to see that searching for classes/long.class file... can you please put your action handler class code?

                • 5. Re: ProcessClassloader question
                  kukeltje

                  and what appserver

                  • 6. Re: ProcessClassloader question

                    Thanks for your responses. See details below, apologies for delayed response as it took some time to simplify the code.

                    Note:
                    1. The handler classes are not packaged in the par file.
                    2. Process is running on jboss 5.0.1.
                    3. If i switch the method parameter from "long" to "Long", there is no exception. The exception comes only for Native type. I can not take this workaround, as EJB is external and can not be modified by me.


                    Simplified code below
                    Process definition

                    <?xml version="1.0" encoding="UTF-8"?>
                    
                    <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="MyProcess">
                    
                     <start-state name="start-state1">
                     <transition to="MyNode"></transition>
                     </start-state>
                    
                     <node name="MyNode" async="true">
                     <action name="MyNode" class="MyHandler"></action>
                     <transition to="end-state1"></transition>
                     </node>
                    
                    <end-state name="end-state1">
                    
                     </end-state>
                    
                    
                    </process-definition>
                    

                    Action Handler
                    
                    /**
                     * @author s
                     *
                     */
                    public class MyHandler implements
                     ActionHandler {
                     private static final long serialVersionUID = 1L;
                    
                     public void execute(ExecutionContext context) throws Exception {
                     try {
                     InitialContext ctx = new InitialContext();
                     RBACServiceI object = (RBACServiceI) ctx.lookup("ps2/RBACService/local");
                    
                     RBACServiceI service = (RBACServiceI) object;
                     service.getRolesBySystemId(263L);
                     } catch (Exception e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                     }
                     }
                    
                    }
                    


                    EJB being invoked
                    @Local
                    public interface RBACServiceI {
                    
                     /**
                     * THis method fetches roles by system id.
                     * @param systemid The system id
                     * @return List of roles
                     */
                     public List<PsRole> getRolesBySystemId(long systemid);
                    
                    
                    
                    }
                    
                    
                    @Stateless
                    public class RBACService implements RBACServiceI {
                    
                     private RBACDLService service = null;
                    
                     public List<PsRole> getRolesBySystemId(long systemid){
                     return service.getRoleBySystemId(systemid);
                     }
                    
                    
                    
                    
                    }
                    


                    • 7. Re: ProcessClassloader question

                      Hi all,
                      Appreciate your help till now,
                      Does the code i pasted above help in explaining the problem clearly!!.
                      I think FileDefinition.java needs a fix(prevent nullpointer and return null), so that ProcessClassLoader can throw a ClassNotfoundException.

                      Please comment!!
                      Sarish

                      • 8. Re: ProcessClassloader question
                        swatis

                        Have put entire stack trace here?

                        • 9. Re: ProcessClassloader question
                          kukeltje

                          Sarish,

                          You might be right in your conclusion. Can you check if the small fix you propose in the jBPM FildeDefinition.java fixes it for you?

                          • 10. Re: ProcessClassloader question
                            lpiccoli

                            hi all,

                            was this issue resolved?

                            if so please identify the solution as i also am having some issue.


                            thanks

                            -lp

                            • 11. Re: ProcessClassloader question
                              aguizar

                              Sarish, there seems to be something wrong here. Can you please create a JIRA issue? If you could give your code the shape of a unit test (that did not require EJBs) that would be great.

                              In particular, the ProcessClassLoader follows the delegation model, meaning that long.class should be resolved by the parent loader and never passed to the ProcessClassLoader.