tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Lonkar <amitlon...@yahoo.com.INVALID>
Subject Re: Class Loader Problems with Tomcat 8 + Ant Task
Date Wed, 28 Oct 2015 17:18:46 GMT
Sorry for the delayed response. Here is the full stack trace. I was assuming that my webapp
would look in WEB-INF/lib for the ant jar and not in the Tomcat/lib. Am I incorrect ??

Thx
Amit
HTTP Status 500 - Servlet execution threw an exception

type Exception report

message Servlet execution threw an exception

description The server encountered an internal error that prevented it from fulfilling this
request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.Class.forName0(Native Method)
	java.lang.Class.forName(Class.java:348)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1284)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
	com.optessa.servlet.TestServlet.doPost(TestServlet.java:33)
	com.optessa.servlet.TestServlet.doGet(TestServlet.java:21)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.ClassNotFoundException: org.apache.tools.ant.Task
	java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	java.security.AccessController.doPrivileged(Native Method)
	java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	java.lang.Class.forName0(Native Method)
	java.lang.Class.forName(Class.java:348)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1284)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
	com.optessa.servlet.TestServlet.doPost(TestServlet.java:33)
	com.optessa.servlet.TestServlet.doGet(TestServlet.java:21)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.26 logs.

Apache Tomcat/8.0.26



> On Oct 22, 2015, at 8:32 AM, Christopher Schultz <chris@christopherschultz.net>
wrote:
> 
> Amit,
> 
> On 10/16/15 3:44 PM, Amit Lonkar wrote:
>> Thanks Chris
>> 
>> Tried two scenarios
>> 
>> 1. Removed any tomcat-*.jar files from webapp/WEB-INF/lib folder. Also moved ant-1.9.6.jar
from webapp/WEB-INF/lib to catalina/lib. All works fine now.
>> 
>> 2. Removed any tomcat-*.jar files from webapp/WEB-INF/lib folder, but this time left
the  ant-1.9.6.jar in webapp/WEB-INF/lib. Got the following error. Since Ant is not shipped
with tomcat we are bundling it with our application. Any reason why Ant needs to be in tomcat/lib
folder?
>> 
>> type Exception report
>> 
>> message Servlet execution threw an exception
>> 
>> description The server encountered an internal error that prevented it from fulfilling
this request.
>> 
>> exception
>> 
>> javax.servlet.ServletException: Servlet execution threw an exception
>> 	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>> root cause
>> 
>> java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
>> 	java.lang.ClassLoader.defineClass1(Native Method)
>> 	java.lang.ClassLoader.defineClass(ClassLoader.java:760)
>> 	java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>> 	java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
>> 	java.net.URLClassLoader.access$100(URLClassLoader.java:73)
>> 	java.net.URLClassLoader$1.run(URLClassLoader.java:368)
>> 	java.net.URLClassLoader$1.run(URLClassLoader.java:362)
> 
> It's all going to come down to which ClassLoader is in effect then the
> thread tries to load that class. Was that the full stack trace? That
> looks like an anonymous permission-executor class to elevate privileges
> for a certain operation.
> 
> -chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org <mailto:users-unsubscribe@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org <mailto:users-help@tomcat.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message