From: Houston, Mike <HoustonM@ge...> - 2001-04-13 15:53:16
Is there any way to force Beanshell to use the same classloader as the JVM
it is running in? I have a problem where an object createded by Beanshell
is not recognized by the JVM as being the same class as it's object (so a
method call fail). I don't mind using the current (JVM's) classpath.
I am integrating Beanshell into our product (an EJB-based product). I am
mostly done, but have hit a problem that I think is related to the way
Beanshell loads classes. I set a variable for the script to access the
calling object (i.set("parent",this)). This will allow my script to call
some convenience methods in the EJB world.
My problem is that when I create an object in the script and pass it to the
parent, it is not treated as a valid type in the JVM. The script example is
BOHandle resHandle=new BOHandle("ResourceBO:MPH,DEFAULT");
Inside of the callEJB method, the JVM doesn't think the scripts BOHandle is
the same as the JVM's BOHandle. They both have the right class name
(com.genrad.frame.BOHandle) but they aren't the same. I guess this is
because Beanshell uses a different class loader, so the JVM doesn't think
they are the same class.
BTW, I had other problems making direct EJB calls. It seems the javac
compiler handles the RMI stub magic, but Beanshell doesn't. I can work
around this issue (hence my code above).
There are also some things you have to do to make Weblogic work with
Beanshell. Let me know if you need more details on how to do this.
Thanks for any help or comments.