[infinispan-dev] tomcat infinispan session manager

Zdeněk Henek vrablik at gmail.com
Fri Dec 9 04:47:12 EST 2011


Hi,

Thanks for reply. I will continue with my work and will push my
changes to the git repository.
Any comments are welcome.
I will do some performance experiments too. I try describe all in github wiki.

>1. classloading issue when used only one shared classloader
> ============================================

The problem is not getting reference of instantiated cache manager.
I get that exception when new entry is moved from one cache to other
remote cache. Cache was in distributed mode.

full stacktrace see attached catalina log file.

Nov 28, 2011 11:57:42 AM
org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher
handle
WARN: Problems unmarshalling remote command from byte buffer
java.lang.ClassNotFoundException: org.vrablik.testlb.RequestLog
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:135)
	at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:116)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:888)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1200)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
	at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
	at org.infinispan.marshall.exts.ArrayListExternalizer.readObject(ArrayListExternalizer.java:57)
	at org.infinispan.marshall.exts.ArrayListExternalizer.readObject(ArrayListExternalizer.java:45)
	at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:384)
	at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:272)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
	at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
	at org.infinispan.atomic.PutOperation$Externalizer.readObject(PutOperation.java:85)

Regards,
Zdenek

On Wed, Dec 7, 2011 at 5:40 PM, Manik Surtani <manik at jboss.org> wrote:
> Hi there.  Sorry for the late response.  I know others on this list are also
> reviewing your code.
>
> Some comments in-line:
>
> On 28 Nov 2011, at 13:13, Zdeněk Henek wrote:
>
> Hi,
>
> I am working on prototype of https://issues.jboss.org/browse/ISPN-465.
>
> Currently works basic functionality like create session, add,update,
> remove values from session, remove session.
> Session could be with or without jvmRoute ... see details
> here:https://github.com/zvrablik/tomcatInfinispanSessionManager)
>
> I have a few questions related to infinispan.
>
> 1. classloading issue when used only one shared classloader
> ============================================
>
> Current master (https://github.com/zvrablik/tomcatInfinispanSessionManager)
> creates
> cache manager per war application. I would like use one shared cache
> manager.
> Is it possible?
>
>
> Yes you can, however you'd need a place to register it.  I'm not sure what
> Tomcat offers - in JBoss AS 7, it is stored as an AS 7 service.  Other
> options may include JNDI or JMX.
>
>
> I have created branch
> (https://github.com/zvrablik/tomcatInfinispanSessionManager/tree/classloader)
> where only first InfinispanSessionManager create DefaultCacheManager.
>
> All created caches set explicitly class loader to configuration and
> DecoratedCache is used to access cache.
> See InfinispanSessionManager.initInfinispan method.
>
> my infinispan configuration (all created caches use default settings):
> <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>            xsi:schemaLocation="urn:infinispan:config:5.0
> http://www.infinispan.org/schemas/infinispan-config-5.0.xsd"
>            xmlns="urn:infinispan:config:5.0">
>  <global>
>    <transport clusterName="tomcatSession"/>
>    <globalJmxStatistics enabled="true" allowDuplicateDomains="true"/>
>  </global>
> <!-- use only default cache for all caches created by session manger -->
> <!-- to specify custom parameters to one cache create named cache with
> name _session_attrContainerName
> where ContainerName is name of war application -->
>
>  <default>
>    <jmxStatistics enabled="true"/>
>    <clustering mode="distribution">
>      <l1 enabled="false" lifespan="600000"/>
>      <hash numOwners="2" rehashRpcTimeout="6000"/>
>      <sync/>
>    </clustering>
>    <invocationBatching enabled="true"/>
>  </default>
> </infinispan>
>
> I use tomcat 6.0.29 and Infinispan 5.1.Beta5, java 6 update 26 on
> Debian stable 64bit.
>
> I get exception on node which should replicate state sent from another node.
> See attached tomcat log.
>
> The missing class is available only through testLB war application
> classloader.
>
> 2. locking and distributed transactions
> ============================
> I use FineGrainedAtomicMap to store session attriubtes. I don't use
> any locking nor XA transactions.
> Do I have to use locking or XA transactions? I think autocommit mode
> could be better in this case
> and tomcat doesn't have XA manager by default. I am using distributed
> transactions only in relational databases.
>
>
> Yes, you probably don't need full XA.  Using Synchronizations should be
> enough.  If you need a full transaction manager, you could pull in JBoss TS
> as a dependency, which is embeddable.
>
> https://github.com/infinispan/infinispan/blob/master/parent/pom.xml#L201
> https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/transaction/lookup/JBossStandaloneJTAManagerLookup.java
>
>
> 3. propagating session events to other nodes, sharing session metadata
> ==============================================
> Is it possible to send (broadcast) custom events through Infinispan?
>
>
> No.
>
>
> Currently it is possible to remove session from all nodes when session
> is removed in any node,
> but there must be done more. Session timeout, session custom events ...
>
> other possible aproach is to create separated cache with session metadata.
> I think creating new cache for metadata is better approach. I think
> there will be
> less network traffic when nodes will get information only when requested.
>
> session object could have assigned listeners and broadcast events
> which are not related to session attributes.
>
>
> Yes, this is possibly a better approach, however others on this list could
> comment more.
>
> Cheers
> Manik
> --
> Manik Surtani
> manik at jboss.org
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: catalinaInfinispanClassloadingIssue.out
Type: application/octet-stream
Size: 15155 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/infinispan-dev/attachments/20111209/5d1a8b58/attachment.obj 


More information about the infinispan-dev mailing list