red5-server: Red5 1.0.6 warDeployer ClassNotFoundException FilterDef
Hi,
I would like to use the wardeployer to deploy my application. But when it parse my web.xml configuration it throw an exception :
ERROR] [Red5_Scheduler_Worker-2] org.apache.tomcat.util.digester.Digester - Begin event threw exception
java.lang.ClassNotFoundException: org.apache.tomcat.util.descriptor.web.FilterDef
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332) ~[tomcat-embed-core.jar:8.0.26]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166) ~[tomcat-embed-core.jar:8.0.26]
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116) ~[tomcat-embed-core.jar:8.0.26]
...
[ERROR] [Red5_Scheduler_Worker-2] org.apache.tomcat.util.descriptor.web.WebXmlParser - Parse error in application web.xml file at file:/opt/red5-server-1.0.6/webapps/test/WEB-INF/web.xml
org.xml.sax.SAXParseException: Error at (32, 13) : org.apache.tomcat.util.descriptor.web.FilterDef
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:1908) ~[tomcat-embed-core.jar:8.0.26]
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:1940) ~[tomcat-embed-core.jar:8.0.26]
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1181) ~[tomcat-embed-core.jar:8.0.26]
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.descriptor.web.FilterDef
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332) ~[tomcat-embed-core.jar:8.0.26]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166) ~[tomcat-embed-core.jar:8.0.26]
My web.xml is :
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<!--
The display-name element contains a short name that
is intended to be displayed by tools. The display
name need not be unique.
-->
<display-name>test</display-name>
<!--
The context-param element contains the declaration of a web
application's servlet context initialization parameters.
-->
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>/test</param-value>
</context-param>
<listener>
<listener-class>org.red5.logging.ContextLoggingListener</listener-class>
</listener>
<filter>
<filter-name>LoggerContextFilter</filter-name>
<filter-class>org.red5.logging.LoggerContextFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LoggerContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>gateway</servlet-name>
<servlet-class>org.red5.server.net.servlet.AMFGatewayServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>gateway</servlet-name>
<url-pattern>/gateway</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>rtmpt</servlet-name>
<servlet-class>org.red5.server.net.rtmpt.RTMPTServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/open/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/idle/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/send/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/close/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/fcs/*</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>/WEB-INF/*</url-pattern>
</web-resource-collection>
<auth-constraint />
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>/persistence/*</url-pattern>
</web-resource-collection>
<auth-constraint />
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>/streams/*</url-pattern>
</web-resource-collection>
<auth-constraint />
</security-constraint>
</web-app>
If I unzip manually the war file, the application start normally. Does anyone know why it happens ?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (6 by maintainers)
I have had a solution. I only reset classLoader in EmbeddedTomcat class
Old code:
public Context addWebapp(Host host, String contextPath, String docBase, ContextConfig config) { Context ctx = createContext(host, contextPath); ctx.setPath(contextPath); ctx.setDocBase(docBase); ctx.addLifecycleListener(new DefaultWebXmlListener()); ctx.setConfigFile(getWebappConfigFile(docBase, contextPath)); ctx.addLifecycleListener(config); config.setDefaultWebXml(noDefaultWebXmlPath()); if (host == null) { getHost().addChild(ctx); } else { host.addChild(ctx); } return ctx; }
New code:
public Context addWebapp(Host host, String contextPath, String docBase, ContextConfig config) { Context ctx = createContext(host, contextPath); ctx.setPath(contextPath); ctx.setDocBase(docBase); ctx.addLifecycleListener(new DefaultWebXmlListener()); ctx.setConfigFile(getWebappConfigFile(docBase, contextPath)); ctx.addLifecycleListener(config); config.setDefaultWebXml(noDefaultWebXmlPath()); if (host == null) { host = getHost(); } // reset ParentClassLoader if(!host.getParentClassLoader().equals(Thread.currentThread().getContextClassLoader())) { host.setParentClassLoader(Thread.currentThread().getContextClassLoader()); } host.addChild(ctx); return ctx; }
Rebuild red5 tomcat plugin and replace the old lib (red5-server\plugins\tomcatplugin-1.12.jar) And it work.
I built a file jar at: https://drive.google.com/file/d/0ByNfPmtze2FjWk1EQjJEaWM4dkk/view?usp=sharing