![]() |
![]() |
||||
This page shows errors where an javax.servlet.ServletException exception is thrown and how to fix them.
Table of Contents
SEVERE: Error reading tld listeners javax.servlet.ServletException: Exception processing TLD at resource path /WEB-INF/someFile.tld in context javax.servlet.ServletException: Exception processing TLD at resource path /WEB-INF/someFile.tld in context at org.apache.catalina.startup.TldConfig.tldScanTld(TldConfig.java:555) at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:301) at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4278) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4115) at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1089) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1187) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:292) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) ...
1. This error usually occurs on the first access to a TLD file which has an error. The error will often prevent the application from deploying at all. Check the log file for another exception directly above this one (org.apache.jasper.JasperException XML parsing error), which specifies the TLD file name, line and column.
If this still doesn't fix the problem, remove the file temporarily and try to redeploy the application. After that, add it back in and redeploy. This should show the error location.
2. In some cases, no other error appears in the logs. If using JSP 2.0 (eg: Tomcat 5.5), the problem is usually that the TLD is using a DTD instead of the new XML format. Change it to the new format. See TLD Files - DTD and XSD for the correct code. Also, remove TLD definitions from web.xml. They are no longer necessary. Tomcat 5.5 and above automatically deploy all TLD files in the classpath when needed. See the article Removing taglib from web.xml for details on how this works.
3. This error can also occur when it is caused by an Invalid TLD resource path error, which appears next in the log (as the Cause of the exception). In this case, the problem is that the specified file cannot be read from the operating system. Check the ownership and permissions of the file.
Caused by: java.lang.IllegalArgumentException: Invalid TLD resource path /WEB-INF/jspwiki.tld at org.apache.catalina.startup.TldConfig.tldScanTld(TldConfig.java:545) ... 28 more
javax.servlet.ServletException: loader constraint violation: when resolving method "org.apache.jasper.compiler.JspRuntimeContext.<init>(Ljavax/servlet/ServletContext;Lorg/apache/jasper/Options;)V" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/apache/jasper/servlet/JspServlet, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/apache/jasper/compiler/JspRuntimeContext, have different Class objects for the type org/apache/jasper/Options used in the signature org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:294) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640) org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286) java.lang.Thread.run(Thread.java:619) ... root cause java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.compiler.JspRuntimeContext.<init>(Ljavax/servlet/ServletContext;Lorg/apache/jasper/Options;)V" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/apache/jasper/servlet/JspServlet, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/apache/jasper/compiler/JspRuntimeContext, have different Class objects for the type org/apache/jasper/Options used in the signature org.apache.jasper.servlet.JspServlet.init(JspServlet.java:76) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) ...
This error will occur when:
See: JAR files you should never include in your webapp
To fix: remove the offending JAR files from your app.
javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.struts.taglib.html.HtmlTag org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852) org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:71) org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:768) ...