Konstantin Kolinko skrev 2014-04-30 01:17:
2014-04-29 12:28 GMT+04:00 Fredrik <fredrik.l.stigb...@sitevision.se>:
Hello.
We're using jamm (https://github.com/jbellis/jamm) a java agent for
measuring object memory usage, passing the javaagent argument
to tomcat as
"-javaagent:../../tomcat/webapps/ROOT/WEB-INF/lib/jamm-0.2.3.jar".
When running 7.0.50 everything works as expected but after upgrading to
7.0.52 the initialization code of the agent (premain-method) isn't called
anymore.
Any ideas?

I understand that that means that you have the same jar present in
both the System classloader and the Webapp classloader.

You should remove that jar from WEB-INF/lib directory of that webapp.

IIRC, in 7.0.50 and earlier Tomcat preferred the class from the system
classloader (effectively ignoring the webapp's jar).

In 7.0.52 it does load the class provided by web application.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Now I get what you mean (I guess). Specifying the javaagent option will automagically add the jar to the system classloader but when the webapp is loaded it's also added to the webapp classloader. since it resides in webapps/ROOT/WEB-INF/lib/. In < 7.0.50 tomcat will load the jar in the system classloader, but in > 7.0.52 it loads it into the webapp classloader which means we'll have a conflict (same jar in different classloaders).

Thanks.
/Fredrik


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to