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
while in decision handler
BSFEngine bsfEngine = this.manager.loadScriptingEngine("beanshell");
this code is throwing exception with message
Unable 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..
Any one have idea about this painstacking issue ??
1 of 1 people found this helpful
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
//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 ?