Thanks Paul for the reply and looking into the issue!!
Could you please tell if this is the reason i am not seeing http sessions getting saved in database ? However i can see cache is getting stored in database properly, but not httpsessions. I have used jboss-web.xml with passivation-config. In my code i just creating the session from request and storing it. Do i need to do something more to store session in db? Could you please tell what I am missing ?
FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); HttpServletRequest httpServletRequest = (HttpServletRequest)externalContext.getRequest(); session =httpServletRequest.getSession(true); // marked session as private transient. session.setAttribute("sessionkey", "sessionvalue");
Appreciate your help . and thanks for continiously bearing me !
Manish - Not sure if it is useful for you or not but I have successfully been able to use a remote store connecting to an infinispan cache in place of a database following Paul's invalidation cache strategy. JBoss AS stored the session in the remote infinispan cache using the hotrod connector and simple failover testing with mod_cluster sticky sessions is working. Only oddity so far is if the infinispan cache is down JBoss AS goes into a loop trying to reconnect and socket errors fill the logs. Of course you would have to configure the infinispan cache if you want disk persistence. Just thought I would throw this out there since it should be swappable with the database alternative you are trying to achieve. And may be a viable solution for you until the cache naming for http sessions gets worked out and is compatible with SQL table names.
Ben, thanks for your valuable suggestion ! My project using Liferay 6.1 and I would like to store liferay portlet sessions in the database. I am bound to use database . As a startup I am first trying to store httpsessions , if it works i will go for portlet sessions.
Well..... Ben, a second thought came in my mind. Why not try with remote store untill the bug get fix. Could you please share steps and configuration to acheive httpsession storage on remote store ? Thanks Ben !!!!
I used JBoss AS 7.1.2.Final. If you have not already you will have to download source and compile yourself. I recommend turning off the test cases when running the maven build.
1) modify the org.infinispan module.xml to have a dependency on the cache loaders and hotrod client.
2) modify the web cache-container to use an invalidation cache backed by a remote-store. Similar to what Paul suggested with the jdbc-store.
<cache-container name="web" aliases="standard-session-cache" default-cache="remote" module="org.jboss.as.clustering.web.infinispan">
<invalidation-cache name="remote" mode="ASYNC" batching="true">
<remote-store passivation="false" purge="false" shared="true">
3) Add an outbound-socket-binding to the socket-binding-group your server is using. This is the host and port of your remote infinispan cache.
<remote-destination host="localhost" port="11222"/>
4) Start an infinispan cache with the hotrod connector.
jboss\infinispan-5.1.5.FINAL\bin>startServer.bat -r hotrod
This got me up and running with a simple two node cluster fronted with mod_cluster. Still lots more testing and optimizations required but please share your experience.
Thanks Ben !! Will try this in couple of days .....
Paul Ferraro wrote:
As it appears to be resolved, could you please tell me how can I implement the fix in JBoss 7.1.1.Final ? what jar/war I need to use ?
Thanks for your time !
* Clone the infinispan git repo and checkout the 5.1.x branch.
* Build it, via mvn -Dmaven.test.skip.exec=true install
* Replace the jars from the modules/org/infinispan/** with the versions you just built.
Thanks Paul for your reply !! Could you please tell me when the fixed version will be available for download with JBOSS 7.1.1 ?
Sorry for the delay response. I tried implemeting httpssession using hot rod. I have some issues so created a new thread.. Could you please have a look ?
Could u please advice how dynamodb can be used for session persistence in jboss cluster.
Thanks in Advance
Had your question been posted in a more appropriate forum, I would have seen it sooner.
In short, you can't easily use dynamodb for session persistence in AS7.
With some work, however, you can do this in WildFly.
1. Implement the SPI from the org.wildfly.clustering.web.spi module. This new module should include a /META-INF/services/org.wildfly.clustering.web.session.SessionManagerFactoryBuilder file that defines the implementation of this class.
2. Modify the module definition for org.wildfly.clustering.web.spi, and replace the org.wildfly.clustering.web.infinispan module dependency with your new module.
3. That's it. WildFly will then auto-load your module and use your dynamodb-based implementation to store web sessions.