-
15. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
techtalk Jul 11, 2012 10:09 AM (in response to pferraro)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 !
-
16. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
dbschofield Jul 16, 2012 8:20 AM (in response to pferraro)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.
-
17. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
techtalk Jul 16, 2012 9:59 AM (in response to dbschofield)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.
-
18. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
techtalk Jul 16, 2012 11:36 AM (in response to techtalk)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 !!!!
-
19. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
dbschofield Jul 16, 2012 8:19 PM (in response to techtalk)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.
<module name="org.infinispan.client.hotrod"/>
<module name="org.infinispan.cachestore.remote"/>
<module name="org.infinispan.cachestore.jdbc"/>
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">
<transport lock-timeout="60000"/>
<invalidation-cache name="remote" mode="ASYNC" batching="true">
<remote-store passivation="false" purge="false" shared="true">
<remote-server outbound-socket-binding="session-datagrid"/>
</remote-store>
</invalidation-cache>
</cache-container>
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.
<outbound-socket-binding name="session-datagrid">
<remote-destination host="localhost" port="11222"/>
</outbound-socket-binding>
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.
-
20. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
techtalk Jul 17, 2012 11:22 AM (in response to dbschofield)Thanks Ben !! Will try this in couple of days .....
-
21. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
techtalk Jul 24, 2012 10:32 AM (in response to pferraro)Paul Ferraro wrote:
Hi Paul,
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 !
-Manish
-
22. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
pferraro Jul 24, 2012 11:16 AM (in response to techtalk)Sure.
* 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.
-
23. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
techtalk Jul 30, 2012 10:38 AM (in response to pferraro)Thanks Paul for your reply !! Could you please tell me when the fixed version will be available for download with JBOSS 7.1.1 ?
-
24. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
techtalk Jul 31, 2012 10:38 AM (in response to dbschofield)Hi Ben,
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 ?
https://community.jboss.org/thread/203371
-Manish
-
25. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
christinaktm Feb 19, 2014 1:31 AM (in response to pferraro)Hi Paul,
Could u please advice how dynamodb can be used for session persistence in jboss cluster.
Thanks in Advance -
26. Re: Jboss 7.x - HA Web Sessions via Database Persistence with Oracle
pferraro Mar 14, 2014 4:42 PM (in response to christinaktm)Christina,
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.