[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] TryFilesFilter giving ClassNotFoundException
|
Hi,
On Wed, Jun 17, 2020 at 4:37 PM Peter Boughton <jetty@xxxxxxxxxxxxxxxxx> wrote:
>
> 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
In this way you are putting the fcgi-server.jar in the *server* classpath.
This means that these classes will be visible to the server (for
example when it is processing Jetty XML context files in
$JETTY_BASE/webapps/, like in your [1] link above), but not visible to
web applications.
What you need to do is to put the fcgi-server.jar in your WEB-INF/lib
so that your web application can see it.
You also need to *not* add fcgi as a server module.
Let know if that worked.
--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.