JBoss Community

Re: couldn't get value for file 'classes/java/lang/bsh.class

created by Sunay Shah in jBPM - View the full discussion

I resolved the issue by my self, for those who are facing the same problem , i am writing solution for them,

 

Actually In a decision handler when you try to initialize the beanshell engine , you have ProcessContextClassLoader but actually you suppose to have webContextClassloader so it is not able to load the BeanShellEngine because it is not able to find the relavent classes that are available in a jar for beanshell. You actually have WebContextClass Loader , following code in decision handler will work

 

ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); // This code will give you ProcessClassLoader

Thread.currentThread().setContextClassLoader(Thread.currentThread().getContextClassLoader().getParent());

//Above line will set  WebContextClassLoader in current thread's classloader now you can write you Beanshell related stuff

 

and finally in finally block you can set your class loader to

     Thread.currentThread().setContextClassLoader(oldClassloader); // that is your processClass Loader

 

 

Thanks

Sunay

Reply to this message by going to Community

Start a new discussion in jBPM at Community