You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by eviladam <aj...@gmail.com> on 2008/08/06 21:45:23 UTC

Invalid Spring Context with ERROR dispatcher?

I have been following a few threads in wicket-users wrt to implementing 404
error pages but I've run into an issue where the Spring configuration does
not seem to be in context of the request when executing through the ERROR
dispatcher.

The exception I'm hitting is:


> org.apache.wicket.RequestCycle -
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'userContext': Scope 'session' is not active for the
> current thread; consider defining a scoped proxy for this bean if you
> intend to refer to it from a singleton; nested exception is
> 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.
> 

The page itself renders without issue when requested directly
(/app/errors/404) but the exception above is thrown in the event of an
actual 404 error (/app/nosuchpage)

The relevant parts of our configuration follows. Any advice or pointers
would be greatly appreciated.

--adam


--- web.xml ---

  <!-- Spring -->
  <listener>
   
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  <listener>
   
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>

  <!-- Wicket -->
  <filter>
    <filter-name>WicketFilter</filter-name>
   
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
    <init-param>
      <param-name>applicationFactoryClassName</param-name>
     
<param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>WicketFilter</filter-name>
    <url-pattern>/app/*</url-pattern>
    <dispatcher>ERROR</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>

  <error-page>
    <error-code>404</error-code>
    <location>/app/errors/404</location>
  </error-page>



-- 
View this message in context: http://www.nabble.com/Invalid-Spring-Context-with-ERROR-dispatcher--tp18858223p18858223.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Invalid Spring Context with ERROR dispatcher?

Posted by dukehoops <ni...@doppelganger.com>.
The problem may be same as here:
http://jira.springframework.org/browse/SPR-4480

Unfortunately, Spring's fix created seems to be JSF-specific, so I guess it
is not possible to have a Wicket error page that accesses Spring context and
is forwarded to using ERROR dispatcher because:
- RequestContextListener is thread local
- thread handling filter in case of ERROR dispatching is distinct from
thread servicing initial request, at least in glassfish (?! The latter makes
little sense to me but that's what the JIRA discussion seems to indicate)

-----
----------------
Nikita Tovstoles
vside.com
----------------

-- 
View this message in context: http://www.nabble.com/Invalid-Spring-Context-with-ERROR-dispatcher--tp18858223p18859140.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org