Thanks for the fantastic response, I pretty excited about getting this working.
David, Pat - I've answered your questions below
On 25 May 2005, at 14:25, David Esterkin wrote:
I am not familiar with oc4j, but I have run BeanShell inside other app servers without a problem.
Can you explain the hierarchy of your environment?
1. Is com/mycompany/aclass the directory structure under c:/oc4j_extended/j2ee/home/myapp/WEB-INF/classes?
Yes it is indeed, basically I written a schedular program that runs beanshell scripts at set times (the user can add the scripts in a form). Things like running a backup, sending an email etc. These are all done via existing classes in the webapp.
2. Where is thisBean?
Just to note "thisBean.class" is a pseudonym for the real class (call me paranoid!). It sits in c:/oc4j_extended/j2ee/home/myapp/WEB-INF/class/com/mycompany/aclass/thisBean.class
My eval menthod sits in a precompiled class called schedular.class (com/mycompany/aclass/schedular.class) that reads the code in from the database and executes it.
3. Where/how is your eval method, and how is it being called?
On 25 May 2005, at 15:50, Pat Niemeyer wrote:
A few questions - You say that the script works fine from a compiled
source? Do you mean that you can get your script to run in some other
environment (other than OC4J?)
I have got this code running JRUN in the past (including Beanshell) so it does seem to be something to do with OC4J and the way it resolves the classpath.
I notice that your bean is named 'thisBean' and your package ends with
'.aclass'. Are these correct? (I'm just going by names here, but
normally classes are capitalized and the package name looks like you might
be expecting a class there).
Sorry, my example should be thisBean.class
I'm not familiar with OC4J... is it necessary to add the classes from the
filesystem are should they be in the context classloader of your web app?
Yes indeed it is, I have my classes in the c:/oc4j_extended/j2ee/home/myapp/WEB-INF/class/ folder of the webapp and the beanshell.jar file in the
c:/oc4j_extended/j2ee/home/myapp/WEB-INF/lib folder of the webapp
Can you try getting the class directly and see what happens?
I am able to reference these classes with normal compiled java code.
Many thanks for your help.