I built a simple application that uses Spring Data 3.1.0.RELEASE and Eclipselink 2.4 on the server side - which is hosted in Tomcat 7.0.27. In mywebapp / META-INF / context.xml I have a Spring classloader
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
If I put spring-instrument-tomcat.jarin $TOMCAT_HOME/lib, then Tomcat will do mywebapp well, but if I put spring-instrument-tomcat.jarin $TOMCAT_HOME/webapps/mywebapp/WEB-INF/lib- Tomcat dies with the exception
java.lang.IllegalStateException: ClassLoader [org.apache.catalina.loader.WebappClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring agent: -javaagent:org.springframework.instrument.jar
The context loader setting useSystemClassLoaderAsParentset to falsedoes not help either.
I don’t want to have a (custom) global library in Tomcat (and it will not be easy to have a global one in our real production system), so I'm trying to localize all the necessary things in a simple (but large) war file. Any thoughts on how to achieve this encapsulation?
source
share