4 Replies Latest reply on Mar 20, 2012 8:49 PM by Shant C

    Cache Container lookup throws ClassCastException Error

    Shant C Newbie

      Hi all,


      I am newbie to both jboss as 7, and infinispan.


      I have not installed infinispan separately, but using the one that comes with Jboss AS 7.1. Using jdk 1.6, and using ant (NOT maven).


      I followed the examples given in quick start guide, and have added this configuration for infinispan to the standalone.xml


      <cache-container name="jboss-as7" default-cache="localCache" jndi-name="java:jboss/infinispan/jboss-as7">

                      <local-cache name="localCache"  start="EAGER">

                          <eviction strategy="LRU" max-entries="10000"/>

                          <expiration max-idle="100000"/>




      and added in jboss-deployment-structure.xml, the dependencies "org.infinispan".


      When I did @Resource(lookup="java:jboss/infinispan/jboss-as7")

                      private CacheContainer container;


      it gives an error saying ClassCastException, not able to cast field container as org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager.


      So when I changed declaration to private DefaultEmbeddedCacheManager container, it still throws that error.


      so I changed the resource to  


      @Resource(mappedName="java:jboss/infinispan/jboss-as7"), but I see IllegalArgumentException..



      Am I missing something?


      I would appreciate any help/ examples ..


      If I am posting in the wrong place.. please redirect as I am new to the forum as well..