Andreas Voss - 2008-03-10

Some people had problems with the EmptyThreadLocalStackException.

JPivot relies on a RequestContext which can be accessed everywhere via RequestContext.instance(). To make this work, the RequestContext instance has to be assigned to a thread local variable.

Normally this the RequestFilter takes care of this. In web.xml, the RequestFilter is mapped to all *.jsp so it is safe to access RequestContext.instance() from JSP Tags etc. If you are using JSF for example and your URLs refer to .jsf pages, make sure that *.jsf is mapped to the RequestFilter in web.xml too.

If you can not use the RequestFilter for some reason, you could programmatically create the RequestContext instance with

    RequestContext context = RequestContextFactoryFinder.createContext(request, response, true);
    try {
      ...
    } finally {
      context.invalidate();
    }

Andreas