tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MrVisser <>
Subject Re: Instantiating a class in shared/lib
Date Mon, 14 Jul 2008 21:45:00 GMT

I'm really sorry everyone I've flooded your Mailing List - I'm new.

The spring library that I needed wasn't being shared either - which caused a
*very* silent error when running Class.forName.

I have it working now.

Sorry again,


MrVisser wrote:
> Hello,
> I'm using spring, and invoking the application context to load on a static
> method.
> I am triggering this static method in the init() method of a servlet.
> I have the following 3 classes:
> public interface api.A
> public class static.A  //which has static method load(String implClass)
> public class spring.B implements A //which contains all spring
> dependencies
> to keep my API from having spring dependencies, I do something like
> following method inside my servlet:
> A a = static.A.load("spring.B"); //actually, the impl string is in a
> properties file
> Now, if api.A and static.A are in A.jar, and spring.B is in spring.jar,
> Class.forName("example.spring.B") does not work (the thread just dies with
> no exception thrown or anything). However,
> Thread.currentThread().getContextClassLoader().loadClass("spring.B") will
> successfully get a reference to the Class object. It just cannot be
> initialized.
> If I move spring.B into A.jar with the rest, everything works fine. This
> holds true with any combination of these JAR files being in common/lib or
> shared/lib.
> What am I missing? Please let me know if you need more information.
> Thanks,
> Branden

View this message in context:
Sent from the Tomcat - User mailing list archive at

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message