AmadeusITGroup / HttpSessionReplacer

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

How can i use payara server with HttpSessionReplacer? #40

Open abucreative99 opened 6 years ago

abucreative99 commented 6 years ago

I am using multitenancy and payara server to deploy my application. I added the library using gradle. How do i use this library in payara server?

nbogojevic commented 6 years ago

Haven't tested it with glassfish/payera. Two approaches you could try Adding agent you can try to add agent to command line/jvm options: it would be something like adding -javagent:$SESSION_PATH/session-agent.jar where $SESSION_PATH is path to where you've downloaded agent jar. Another options is to add a SessionFilter as first filter in chain - this needs to be done in web.xml of your web app.

abucreative99 commented 6 years ago

Thank you for your expert feedback. Below is what i did: I have added the agent in the jvmoptions of my container(payara).

-javaagent:/home/session-agent-0.4.9.jar

Then I added the libraries to my project: the session-agent and the session-replacement library. Also, I have added the SessionFilter as the first filter in my web.xml as shown below:

<filter> <filter-name>SessionFilter</filter-name> <filter-class>com.amadeus.session.servlet.SessionFilter</filter-class> </filter> <filter-mapping> <filter-name>SessionFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

I am not sure how to test if it works or how to access the sessionId saved.

Your quick help is greatly appreciated.

RafaelAlthaus commented 5 years ago

I did the same thing described by abucreative99, but I'm getting the following error when I open my login page. Any idea why?

arning: StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception java.lang.NullPointerException at org.jboss.weld.context.beanstore.http.AbstractSessionBeanStore.getLockStore(AbstractSessionBeanStore.java:116) at org.jboss.weld.context.beanstore.AttributeBeanStore.lock(AttributeBeanStore.java:251) at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:90) at org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:76) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100) at org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.get(ContextualInstanceStrategy.java:177) at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)