You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/03/27 16:15:34 UTC
DO NOT REPLY [Bug 18411] New: -
Different ClassLoader behaviour depending on how an application is deployed
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18411>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18411
Different ClassLoader behaviour depending on how an application is deployed
Summary: Different ClassLoader behaviour depending on how an
application is deployed
Product: Tomcat 4
Version: 4.1.24
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: Other
Component: Unknown
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: matthias.bauer@livinglogic.de
Depending on how an application is deployed, i. e.
a) throwing it into the webapps directory
b) configuring the context in server.xml
the classloader behaves differently:
In (a) the directory $CATLINA_HOME/shared/lib/ is searched for *.jar files in
case (b) it is not.
I observed this behaviour during application development and tried to track it
down as far as possible. The following description is only a method how to
easily reproduce this behviour and is artificially constructed. The real-world
implication is that I cannot use the directory $CATLINA_HOME/shared/lib/ for my
shared libraries, but have to use $CATLINA_HOME/common/lib/ until this bug is fixed.
Now here is a very easy way to prove that class loading behaves different
depending on how an application is deployed:
1.Create a sample file test.jsp with the following line of code:
<% Object o = new NonExistingClass(); %>
Compiling this JSP file will always fail, because NonExistingClass does not exist.
2.Deploy this file in a subdirectory of webapps and access it via a browser. The
file logs/localhost_log.2003-03-27.txt will show a compile error like the one
that is attached (Attachment 1) below. In the trace the jar files from
$CATALINA_HOME/shared/lib/ are listed in the classpath
3. Deploy the same file in a different directory, configure a context in
server.xml and access it via a browser: Now the file
logs/localhost_log.2003-03-27.txt will show an error trace like the one that is
attached as the second listing: Here the jars from $CATALINA_HOME/shared/lib/ do
not appear in the classpath instead all jars from $CATALINA_HOME/server/lib/ are
listed.
===== Attachement 1: Begin ===========
2003-03-27 15:45:50 Error compiling file:
/home/hias/tomcat4/work/Standalone/localhost/test/test_jsp.java [javac]
Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] /home/hias/tomcat4/work/Standalone/localhost/test/test_jsp.java:41:
cannot resolve symbol
[javac] symbol : class NonExistingClass
[javac] location: class org.apache.jsp.test_jsp
[javac] Object o = new NonExistingClass();
[javac] ^
[javac] 1 error
2003-03-27 15:45:50 Info: Compile:
javaFileName=/home/hias/tomcat4/work/Standalone/localhost/test/test_jsp.java
classpath=/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/classes/:/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/xerces.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/activation.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/jdbc2_0-stdext.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/mail.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/classes/:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-collections.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/servlet.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-compiler.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-factory.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-runtime.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-resources.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/ant.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-logging-api.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-common.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/classes
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/xerces.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/activation.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/jdbc2_0-stdext.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/shared/lib/mail.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/classes
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-collections.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/servlet.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-compiler.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-factory.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-runtime.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-resources.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/ant.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-logging-api.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-common.jar
work dir=/home/hias/tomcat4/work/Standalone/localhost/test
srcDir=/home/hias/tomcat4/work/Standalone/localhost/test
include=test_jsp.java
Exception compiling Compile failed; see the compiler error output for details.
2003-03-27 15:45:50 Exception:
Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:317)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
...
===== Attachement 1: End ===========
===== Attachement 2: Begin ===========
2003-03-27 16:02:45 Error compiling file:
/home/hias/tomcat4/work/Standalone/localhost/~hias_test1/test_jsp.java
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac]
/home/hias/tomcat4/work/Standalone/localhost/~hias_test1/test_jsp.java:41:
cannot resolve symbol
[javac] symbol : class NonExistingClass
[javac] location: class org.apache.jsp.test_jsp
[javac] Object o = new NonExistingClass();
[javac] ^
[javac] 1 error
2003-03-27 16:02:45 Info: Compile:
javaFileName=/home/hias/tomcat4/work/Standalone/localhost/~hias_test1/test_jsp.java
classpath=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/classes/:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/catalina-ant.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-jk2.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-coyote.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-util.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-http11.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-common.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-invoker.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-logging.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/mx4j-jmx.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-digester.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/catalina.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-fileupload-1.0-beta-1.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-default.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-manager.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/jakarta-regexp-1.2.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-warp.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-modeler.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-jk.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-beanutils.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-webdav.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/classes/:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-collections.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/servlet.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-compiler.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-factory.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-runtime.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-resources.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/ant.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-logging-api.jar:/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-common.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/classes
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/catalina-ant.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-jk2.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-coyote.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-util.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-http11.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-common.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-invoker.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-logging.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/mx4j-jmx.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-digester.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/catalina.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-fileupload-1.0-beta-1.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-default.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-manager.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/jakarta-regexp-1.2.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-warp.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-modeler.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/tomcat-jk.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/commons-beanutils.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/server/lib/servlets-webdav.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/classes
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-collections.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/servlet.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-compiler.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-factory.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/jasper-runtime.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-resources.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/ant.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/commons-logging-api.jar
cp=/opt/jakarta-tomcat-4.1.24-LE-jdk14/common/lib/naming-common.jar
work dir=/home/hias/tomcat4/work/Standalone/localhost/~hias_test1
srcDir=/home/hias/tomcat4/work/Standalone/localhost/~hias_test1
include=test_jsp.java
Exception compiling Compile failed; see the compiler error output for details.
2003-03-27 16:02:45 Exception:
Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:317)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
...
===== Attachement 2: End ===========
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org