Class not found in namespace errors in a separate Thread in web applications

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Class not found in namespace errors in a separate Thread in web applications

Wade Chandler-6
I think I have written on this subject before, and if
so then apologies.  I've seen messages about this
before with no definitive answers.  The main issue is
this.  I can run scripts and access my class package
fine from the Thread running the servlet request (in
this case Axis web service, but no mistake we're still
dealing with a servlet call).  I have one service
which creates separate threads to process data and
uses checks from another service to allow the client
to later check on the status of this long running
operation.    The bsh.Interpreter instances from this
separate thread keep throwing Class "blah blah" not
found in namespace errors.  I tracked the issue down
to the lines:
                if ( clas == null )
                        throw new ClassNotFoundException(
                                "Class: " + value+ " not found in namespace");

In of bsh.Name and all I can come up with is
that for some reason the Interpreter is breaking in
this threaded environment.  I'm not exactly sure why
as I can dynamically create instances of classes using
Class.forName from this thread, so I'm trying to
figure out if anyone has any ideas (maybe something I
can't see in the code which occurs in threaded
situations that someone knows about).  In both cases
where I'm calling it from the servlet thread and this
extra thread I'm instantiating bsh.Interpreter, not
setting a class loader, and passing script file paths.
 The bsh jar is in my WEB-INF/lib directory.



This email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
Beanshell-users mailing list
[hidden email]