Cross context forward to spring No thread-bound request found: Are you referring to..
Hello,
I am using cocoon 2.2.0 that uses spring and also urlrewrite 3.2.0, tomcat 6.0.18 java 1.6.0_12-b04
Two web applications are set up with crossContext="true"
When I redirect from the context running urlrewrite to the cocoon one I get the stack traces below
It appears that the spring filters dont get run on the cross context forward as the message "Bound request context to thread" is never printed,
Is it true that filters do not run on a cross context forward?
If thats true that doesnt make much sense to me.
Is it the same request for both contexts?
I thought of putting the springframework in a shared class loader for both applications, with the filter configuration in the originating context. I presume that would work.
However I dont think thats the best solution.
I also thought of putting a custom thread local class in the shared class loader just to pass the request but Id prefer to avoid that.
Can someone explain what is happening and what the best solution is.
Thanks in advance,
Andy Bailey
Ill post the stack traces in a reply to this email as this forum wont let me post them here
17.03.2009 00:53:14 *DEBUG* RuleBase: matched "from" (Log.java, line 210)
catalina.out 17.03.2009 00:53:14 *DEBUG* RuleExecutionOutput: needs to be forwarded to /hazlo/strat/ChangeGov.xhtml (Log.java, line 210)
catalina.out 17.03.2009 00:53:14 *DEBUG* UrlRewriter: got a rewritten url (Log.java, line 153)
catalina.out 17.03.2009 00:53:14 *DEBUG* RewrittenUrl: doRewrite called (Log.java, line 153)
localhost.2009-03-17.logMar 17, 2009 12:53:14 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet DispatcherServlet threw exception
in the web.xml
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>
org.springframework.web.filter.RequestContextFilte r
</filter-class>
</filter>
Looking at the code for DispatcherServlet it wasnt handling the case of a cross context forward. Looks like it was a cocoon problem after all. Oops sorry for posting it here!
public class DispatcherServlet extends org.apache.cocoon.servletservice.DispatcherServlet
{
/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
private boolean threadContextInheritable = false;
/**
* Set whether to expose the LocaleContext and RequestAttributes as
* inheritable for child threads (using an
* {@link java.lang.InheritableThreadLocal}).
* <p>
* Default is "false", to avoid side effects on spawned background threads.
* Switch this to "true" to enable inheritance for custom child threads
* which are spawned during request processing and only used for this
* request (that is, ending after their initial task, without reuse of the
* thread).
* <p>
* <b>WARNING:</b> Do not use inheritance for child threads if you are
* accessing a thread pool which is configured to potentially add new
* threads on demand (e.g. a JDK
* {@link java.util.concurrent.ThreadPoolExecutor}), since this will expose
* the inherited context to such a pooled thread.
*/
public void setThreadContextInheritable(boolean threadContextInheritable)
{
this.threadContextInheritable = threadContextInheritable;
}