While trying to use the Eclipse Jetty launcher for testing cocoon-webapp I got the error:

java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request? If you are actually operating within a web request and still receive this message,your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.

Which was discussed in http://marc2.theaimsgroup.com/?l=xml-cocoon-dev&m=116724829330124&w=2 (this happens if the container doesn't support servlet 2.4). I found this strange as the web.xml in cocoon-webapp is configured to use servlet 2.4 and Jetty 5.1 that is used in the Eclipse Jetty Launcher also supports servlet 2.4.

After some searching at the web I found out that Jetty 5.1 doesn't support request listener by default.

The way to turn on request listener support is to take a copy of the file etc/webdefault.xml in the Jetty 5.1 distribution and uncomment the jsr154 filter definition in the end of the file. After that you need to go to your Jetty launcher run configuration in Eclipse, choose "Use custom webdefaults config file" and point it to your modified webdefault.xml file.

After the Jetty launcher works with cocoon-webapp again.

/Daniel

Reply via email to