-
1. Re: couldn't get value for file 'classes/java/lang/bsh.class
sunay Dec 9, 2010 12:47 AM (in response to sunay)Hello All,
I think the problem is at the jbpm3.2.6 only because i have made one test class with the same jar files and its able to load Beanshell , which is not possible in my decision Handler
see my test class has following code
BSFManager bsfManager = new BSFManager();
BSFEngine bsfEngine = bsfManager.loadScriptingEngine("beanshell");System.out.println("==> Engine loaded successfully");
System.out.println("=====>" + bsfEngine.getClass().getName());this is able to load the bsfengine and prints
==> Engine loaded successfully
=====>bsh.util.BeanShellBSFEnginewhile in decision handler
BSFEngine bsfEngine = this.manager.loadScriptingEngine("beanshell");
this code is throwing exception with messageUnable to load Language : beanshell
and log this exception
org.jbpm.JbpmException: couldn't get value for file 'classes/java/lang/bsh.class'
I am using following jars..
bsh.jar
bsf.jar
bsh-2.0b2.jar
Any one have idea about this painstacking issue ??
Thanks
Sunay
-
2. Re: couldn't get value for file 'classes/java/lang/bsh.class
sunay Dec 9, 2010 1:59 AM (in response to sunay)1 of 1 people found this helpfulI 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
Is there any Bug in JBPM3.2.6 SP1 , Is it resolved ? if Yes then which version should i take ?
Thanks
Sunay