Reputation: 665
My application uses Spring Framework 3.0.5 on JBoss 5.1.0.GA. The framework is provided by the server, that is, framework libraries are placed in server/<servername>/lib
directory. The server is managed by third party, so I can't add any library to environment provided by this server. There is a necessity to use cglib in my application. Spring uses it for proxying purposes. cglib isn't in server/<servername>/lib
, therefore I've included cglib-2.2.2.jar
to my app .war
with maven.
The problem is that the following error occures on deploy:
Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
I've checked my app .war
for cglib and found it in WEB-INF/lib
directory. AFAIK all classes in jars located in this directory are in class path as well as classes in jars in server/<servername>/lib
. Why Spring can't find cglib?
Upvotes: 1
Views: 1008
Reputation: 403551
For the purposes of this question, the JBoss classloader hierarchy can only look "down", i.e. classes loaded by the system classloader cannot see classes in an application's lib directory. So the Spring libraries in the server's lib directory cannot see cglib in your app's lib directory.
Possible solutions, in order of preference:
Option 3 is far from ideal, since duplicating classes between classloaders is a recipe for classloader issues, but it may be your only option.
Upvotes: 3