2 Replies Latest reply on Dec 9, 2010 1:59 AM by Sunay Shah

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

    Sunay Shah Apprentice

      Hello All ,


      I get the following exception when i am trying to run bean shell script from my code


      org.jbpm.JbpmException: couldn't get value for file 'classes/java/lang/bsh.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:306)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
          at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:242)
          at bsh.classpath.ClassManagerImpl.plainClassForName(Unknown Source)
          at bsh.classpath.ClassManagerImpl.classForName(Unknown Source)
          at bsh.NameSpace.classForName(Unknown Source)
          at bsh.NameSpace.getImportedClassImpl(Unknown Source)
          at bsh.NameSpace.getClassImpl(Unknown Source)
          at bsh.NameSpace.getClass(Unknown Source)
          at bsh.Name.consumeNextObjectField(Unknown Source)
          at bsh.Name.toObject(Unknown Source)



      I am using jbpm3.2.6 , jboss 5,


      i droped bsh-2.0b2.jar in my lib folder of my application, any idea or suggestion?



      Is it a bug in jbpm3.2.6, because i found that on bug list... but its resolved? what is the resolutionn of that bug. My decision handler code is calling the beanshell script , but it is saying that unable to load language :beanshell , i verified that all the jars are implace,


      Any Idea or suggestion ?




        • 1. Re: couldn't get value for file 'classes/java/lang/bsh.class
          Sunay Shah Apprentice

          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


          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 ??





          • 2. Re: couldn't get value for file 'classes/java/lang/bsh.class
            Sunay Shah Apprentice

            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 ?





            1 of 1 people found this helpful