RE: Major Tomcat classloading issues with javaagent command line switch

2010-04-06 Thread Arshan Dabirsiaghi
I've tried this outside Eclipse with Tomcat 6.0.26 on both Java 1.5.0_22
and Java 1.6.0_18:

SET JAVA_OPTS=-javaagent:C:\path-to-agent.jar

JSP's seem to work fine, but anytime you try to access a Servlet you get
the same thing:

javax.servlet.ServletException: Error allocating a servlet instance
 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)
 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
98)
 
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.j
ava:859)
 
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.proce
ss(Http11AprProtocol.java:579)
 
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
java.lang.Thread.run(Thread.java:619)

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
java.lang.ClassLoader.findBootstrapClass(Native Method)
 
java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:927)
java.lang.ClassLoader.loadClass(ClassLoader.java:298)
java.lang.ClassLoader.loadClass(ClassLoader.java:296)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
.java:1431)
 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader
.java:1361)
 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)
 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
98)
 
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.j
ava:859)
 
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.proce
ss(Http11AprProtocol.java:579)
 
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
java.lang.Thread.run(Thread.java:619)

Can anyone else confirm?
Arshan

-Original Message-
From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] 
Sent: Tuesday, April 06, 2010 12:34 AM
To: Tomcat Users List
Subject: RE: Major Tomcat classloading issues with javaagent command
line switch

 From: Arshan Dabirsiaghi
[mailto:arshan.dabirsia...@aspectsecurity.com]
 Subject: Major Tomcat classloading issues with javaagent command line
 switch
 
 The bottom line appears to be this: across Tomcat and JDK versions,
you
 can't use the javaagent switch and have a working web app.

Wrong conclusion.  Try running Tomcat directly, not under Eclipse; the
problem you're having is most likely due to Eclipse insisting on doing
things its own way, ignoring configuration that you have set up.  Deploy
your war to a stand-alone Tomcat and try it again.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.


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


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



Re: Major Tomcat classloading issues with javaagent command line switch

2010-04-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Arshan,

On 4/6/2010 12:04 AM, Arshan Dabirsiaghi wrote:
 The bottom line appears to be this: across Tomcat and JDK versions, you
 can't use the javaagent switch and have a working web app.

This works for me under the following environment:

$ bin/catalina.sh version
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.26
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.26
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.26/temp
Using JRE_HOME:/usr
Using CLASSPATH:   /usr/local/apache-tomcat-6.0.26/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.26
Server built:   March 9 2010 1805
Server number:  6.0.26.0
OS Name:Linux
OS Version: 2.6.18-14-fza-686-bigmem
Architecture:   i386
JVM Version:1.6.0_12-b04
JVM Vendor: Sun Microsystems Inc.

The command line for my running JVM looks like this:

/usr/bin/java -Dnop -Xmx64M
- -agentpath:/home/cschultz/yjp-8.0.6/bin/linux-x86-32/libyjpagent.so=
- -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
- -Djava.endorsed.dirs=/usr/local/apache-tomcat-6.0.26/endorsed -classpath
/usr/local/apache-tomcat-6.0.26/bin/bootstrap.jar
- -Dcatalina.base=/home/cschultz/.webapps/xxx
- -Dcatalina.home=/usr/local/apache-tomcat-6.0.26
- -Djava.io.tmpdir=/home/cschultz/.webapps/xxx/temp
org.apache.catalina.startup.Bootstrap start

What does yours look like?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAku7UNUACgkQ9CaO5/Lv0PCxFwCfa5/zxoTvyYF5x9/sNy2STxGY
Pb8AoIMd66jZvvTqqmu1yTZzg2/+U0Np
=8BCW
-END PGP SIGNATURE-

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



Re: Major Tomcat classloading issues with javaagent command line switch

2010-04-06 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Arshan,

On 4/6/2010 11:18 AM, Christopher Schultz wrote:
 The command line for my running JVM looks like this:
 
 /usr/bin/java -Dnop -Xmx64M
 -agentpath:/home/cschultz/yjp-8.0.6/bin/linux-x86-32/libyjpagent.so=

Sorry, I didn't see that you were using a Java-language agent. I haven't
tried this.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAku7WDUACgkQ9CaO5/Lv0PBGTACdG2gUuUsT55SlfDKKOGgagp27
qG4An2LtLnwavrnj79jPJ6oUwQZowhhW
=Mx79
-END PGP SIGNATURE-

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



RE: Major Tomcat classloading issues with javaagent command line switch

2010-04-06 Thread Arshan Dabirsiaghi
Just to close the loop here, the problem was that the class was being loaded 
twice - once from inside the *agent* jar, and another duplicate later from 
WEB-INF/classes. I guess Tomcat or Java was confused as to which version they 
wanted to use. Not 100% sure what happened, but removing it from the agent jar 
fixed the problem.

Thanks!
Arshan

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Tuesday, April 06, 2010 11:50 AM
To: Tomcat Users List
Subject: Re: Major Tomcat classloading issues with javaagent command line switch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Arshan,

On 4/6/2010 11:18 AM, Christopher Schultz wrote:
 The command line for my running JVM looks like this:
 
 /usr/bin/java -Dnop -Xmx64M
 -agentpath:/home/cschultz/yjp-8.0.6/bin/linux-x86-32/libyjpagent.so=

Sorry, I didn't see that you were using a Java-language agent. I haven't
tried this.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAku7WDUACgkQ9CaO5/Lv0PBGTACdG2gUuUsT55SlfDKKOGgagp27
qG4An2LtLnwavrnj79jPJ6oUwQZowhhW
=Mx79
-END PGP SIGNATURE-

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



Re: Major Tomcat classloading issues with javaagent command line switch

2010-04-06 Thread Konstantin Kolinko
2010/4/7 Arshan Dabirsiaghi arshan.dabirsia...@aspectsecurity.com:
 Just to close the loop here, the problem was that the class was being loaded 
 twice - once from inside the *agent* jar, and another duplicate later from 
 WEB-INF/classes. I guess Tomcat or Java was confused as to which version they 
 wanted to use. Not 100% sure what happened, but removing it from the agent 
 jar fixed the problem.

The servlet spec requires that the webapp classes and libraries were
preferred over the ones provided by Tomcat. More details in [1]At
the same time, web applications are short-lived and can be stopped /
undeployed at any time, at which point their classloader and their
classes become unavailable.  Using those for something that is
JVM-wide may lead to leaked memory at best, or do not work at all.

[1] http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

Best regards,
Konstantin Kolinko

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



RE: Major Tomcat classloading issues with javaagent command line switch

2010-04-05 Thread Caldarale, Charles R
 From: Arshan Dabirsiaghi [mailto:arshan.dabirsia...@aspectsecurity.com]
 Subject: Major Tomcat classloading issues with javaagent command line
 switch
 
 The bottom line appears to be this: across Tomcat and JDK versions, you
 can't use the javaagent switch and have a working web app.

Wrong conclusion.  Try running Tomcat directly, not under Eclipse; the problem 
you're having is most likely due to Eclipse insisting on doing things its own 
way, ignoring configuration that you have set up.  Deploy your war to a 
stand-alone Tomcat and try it again.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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