AmadeusITGroup / HttpSessionReplacer

Store JEE Servlet HttpSessions in Redis
MIT License
49 stars 33 forks source link

SessionAgent is accesing and wrapping existing filters but it fails with IllegalAccessException on an AbstractFilter: #30

Open iigou opened 6 years ago

iigou commented 6 years ago

I am trying to integrate RCS in a JBoss EAP 6.4 in a spring web application. So far i have integrated HttpSession as described here: https://github.com/AmadeusITGroup/HttpSessionReplacer/blob/master/docs/Usage.md. Session agent seems to be active as i can see through the logs. SessionAgent is accesing and wrapping existing filters but it fails with IllegalAccessException on an AbstractFilter with the following error:

16:25:53,332 INFO  [stdout] (ServerService Thread Pool -- 85) SessionAgent: Transforming Filter implementation filters/AbstractServletFilter
16:25:53,333 INFO  [stdout] (ServerService Thread Pool -- 85) SessionAgent: Enhancing existing init(...) method in class filters/AbstractServletFilter
16:25:53,336 INFO  [stdout] (ServerService Thread Pool -- 85) SessionAgent: Enhancing doFilter in class filters/AbstractServletFilter
16:25:53,339 INFO  [stdout] (ServerService Thread Pool -- 85) SessionAgent: Adding injected methods in filter class filters/AbstractServletFilter
16:25:58,548 INFO  [org.apache.karaf.main.Main] (Karaf Lock Monitor Thread) Lock acquired. Setting startlevel to 100
16:25:58,929 INFO  [stdout] (ServerService Thread Pool -- 85) SessionAgent: Unable to access element in parent class class org.springframework.web.filter.GenericFilterBean of filter class org.springframework.web.filter.OncePerRequestFilter. Cause java.lang.IllegalAccessException: no such method: org.springframework.web.filter.GenericFilterBean.doFilter(ServletRequest,ServletResponse,FilterChain)void/invokeSpecial

The application doesn't fail at this point, but later on i can see that there are multiple sessions created:

16:27:21,773 INFO  [com.amadeus.session.servlet.SessionHelpers] (http-0.0.0.0:10080-20) ServletContext was null when prepareRequest() was called from Filter. This means that filter's init() method was not called at initialization time. This may result in unexpected behavior if this filter was invoked afterservlet dispatch forward() and include() calls.
16:27:21,845 INFO  [com.amadeus.session.SessionManager] (http-0.0.0.0:10080-20) Creating new session with sessionId: 'f4x9fbjHD-Ia7IS5ZYPmlWVUJEO3APiIo6UEIj6G!1513700841845'
16:27:31,758 INFO  [com.amadeus.session.servlet.SessionHelpers] (http-0.0.0.0:10080-22) ServletContext was null when prepareRequest() was called from Filter. This means that filter's init() method was not called at initialization time. This may result in unexpected behavior if this filter was invoked afterservlet dispatch forward() and include() calls.

Note that the Session Repository is IN_MEMORY for dev purposes.

Attached you can find logs containing the errors.

logs.txt