-
1. Re: Several Web Apps using Infinispan DIST in one application server
an1310 Nov 24, 2010 9:24 AM (in response to larry2kk)1 of 1 people found this helpfulAny number of ways. A way I've done it is export the cache manager to JNDI, and have your WARs get the cache (from the cache manager) that way.
-
2. Re: Several Web Apps using Infinispan DIST in one application server
larry2kk Nov 24, 2010 9:03 PM (in response to an1310)Hi Erik,
I followed your advice by creating a JCA component that initiates a DefaultCacheManager and binds it to JNDI.
This gives me classcast errors when I try to look the cache manager up from my web applications. (Due to not reading the classes from the same classloader I suspect)
Any advice on better ways of getting it to work or alternative ways?
-
3. Re: Several Web Apps using Infinispan DIST in one application server
vblagojevic Nov 26, 2010 7:11 AM (in response to larry2kk)Erik, would you mind writing a quick setup instrunction for web container enviroenment? I've seen several posts where users are trying to setup Infinispan within web container and they all encounter classloading issues.
Much appreciated,
Vladimir
-
4. Re: Several Web Apps using Infinispan DIST in one application server
henk53 Nov 26, 2010 9:59 AM (in response to vblagojevic)Also, wasn't there a plan to have some cache manager available by default in JBoss AS 6, kinda like we also have the java:/DefaultDS?
-
5. Re: Several Web Apps using Infinispan DIST in one application server
an1310 Nov 29, 2010 10:13 AM (in response to vblagojevic)1 of 1 people found this helpfulHi all. I'm back from Thanksgiving vacation.
Here's a pattern that works for me:
1. I create a SAR that does nothing more than export the cache manager to JNDI. This is deployed before any of my WARs. The implementation of the SAR is from this unit test case.
2. From my WARs, I simply do a InitialContextLookup:
(DefaultCacheManager)context.lookup("java:CacheManager");
From there, I can get my named caches.
If I get some time, I can post some sample code.
-
6. Re: Several Web Apps using Infinispan DIST in one application server
larry2kk Nov 29, 2010 10:28 AM (in response to an1310)Hi,
I'm using Glassfish, so I'm one out there not on Jboss.
Luckily, I was able to create a Infinispan + Cassandra loader OSGi bundle with an Activator that registered both the cache manager and the named caches in JNDI.
Unluckily, it's hard to specify that my we application was dependent on my bundle (to ensure the bundle is started before my web apps), so I had to resolve it by lazily in the web app looking up the cache in question from JNDI, and if my bundle was not activated, I'd just reply with an IllegalState error.
-
7. Re: Several Web Apps using Infinispan DIST in one application server
manik Dec 7, 2010 4:16 AM (in response to larry2kk)There's useful stuff here. Guys, as Vladimir suggested, would you mind creating a wiki page on howto integrate Infinispan with webapps on various web containers?
-
8. Re: Several Web Apps using Infinispan DIST in one application server
mircea.markus Dec 8, 2010 3:12 PM (in response to larry2kk)This is ugly but...what about a static field somewhere?
-
9. Re: Several Web Apps using Infinispan DIST in one application server
galder.zamarreno Dec 21, 2010 10:19 AM (in response to mircea.markus)Mircea, you want to create havoc??? Static references to classes in managed environments can lead to memory leaks. I can't remember the exact details, but one of the reasons JDBC drivers could never be deployed in deploy/ directory and instead had to go in the lib/ dir is due to the javax.sql package keeping some static reference to the JDBC driver or its classes which stopped the deployed ear/war...etc from being garbage collected.