[jboss-dev-forums] [JBoss AS 7 Development] - ClassCastException with Infinispan using multiple applications

Randy Nott do-not-reply at jboss.com
Thu Nov 17 19:46:35 EST 2011


Randy Nott [http://community.jboss.org/people/rnott] created the discussion

"ClassCastException with Infinispan using multiple applications"

To view the discussion, visit: http://community.jboss.org/message/637100#637100

--------------------------------------------------------------
I'm getting a ClassCastException when using an Infinispan cache to share data between two web applications, A and B running in the same JBoss AS-7 instance. Application A writes to the cache while application B reads from it. Application B fails on the read as the value is tied to the classloader of application A.

I've tried this with both standalone and HA configurations in JBoss AS-7.0.2, defining the cache as local, then distributed, with similar results. Here is my cache configuration (standalone-preview-ha.xml):


<cache-container name="foo-cache" default-cache="foo">
  <distributed-cache mode="ASYNC" name="foo" start="EAGER">
      <eviction strategy="NONE"/>
  </distributed-cache>
</cache-container>



I'm injecting the cache into both web applications using CDI with the following producer:


@Resource(mappedName="java:jboss/infinispan/foo-cache") 
private CacheContainer container;

@FooCache
@Produces @ApplicationScoped
Cache<String, Foo> fooCache() {
    return container.getCache( "foo" );
}



I'd prefer that the cache be embedded in the JBoss instance as opposed to remote if this is possible. Does anyone know the recipe for making this work?
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/637100#637100]

Start a new discussion in JBoss AS 7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20111117/f0f95016/attachment.html 


More information about the jboss-dev-forums mailing list