[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] TryFilesFilter giving ClassNotFoundException
|
The Jetty docs for FastCGI [1] give an example for TryFilesFilter which works, using addFilter in a ServletContextHandler webapp configuration, but I'm trying to get it work as per the TryFilesFilter API docs [2] with *no FastCGI involved*.
[1] https://www.eclipse.org/jetty/documentation/current/configuring-fastcgi.html
[2] https://www.eclipse.org/jetty/javadoc/current/org/eclipse/jetty/fcgi/server/proxy/TryFilesFilter.html
With the appropriate filter tags in web.xml, the context fails to start with the following exceptions:
2020-06-17 15:18:50.472:WARN:oejs.BaseHolder:main:
java.lang.ClassNotFoundException: org.eclipse.jetty.fcgi.server.proxy.TryFilesFilter
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:565)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at org.eclipse.jetty.util.Loader.loadClass(Loader.java:64)
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:88)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:92)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
...(snip)...
2020-06-17 15:18:50.492:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@9660f4e{ROOT,/,file:///opt/try-files-test/webapps/ROOT/,UNAVAILABLE}{/opt/try-files-test/webapps/ROOT}
javax.servlet.UnavailableException: Class loading error for holder try_files@32eebfca==org.eclipse.jetty.fcgi.server.proxy.TryFilesFilter,inst=false,async=false
at org.eclipse.jetty.servlet.BaseHolder.doStart(BaseHolder.java:95)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:92)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
...(snip)...
I've produced a minimal example, where Jetty is started with:
java -jar ../jetty-distribution-9.4.30.v20200611/start.jar --module=fcgi,http,deploy
There's a few HTML files in webapps/ROOT, and webapps/ROOT/WEB-INF/web.xml contains:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>try_files</filter-name>
<filter-class>org.eclipse.jetty.fcgi.server.proxy.TryFilesFilter</filter-class>
<init-param>
<param-name>files</param-name>
<param-value>maintenance.html $path missing.html</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>try_files</filter-name>
<url-pattern>/</url-pattern>
</filter-mapping>
</web-app>
Am I doing something wrong, or is the issue with the filter?
Thanks,
Peter