-
1. Re: ClassCastException when accessing CacheManager in jBoss 7.1.1
viktor Jul 5, 2012 1:53 AM (in response to viktor)Ok... no answers.
Wondering if anybody has managed to use infinispan under jBoss 7.1.1 and Java 1.6 at all.
I suspect that everybody uses Java 1.7... Is it correct?
-
2. Re: ClassCastException when accessing CacheManager in jBoss 7.1.1
galder.zamarreno Jul 10, 2012 7:44 AM (in response to viktor)1 of 1 people found this helpfulWhat's most likely happening is that you're embedding AS7 classes in your application and that's causing classloader issues, because the same class that belongs to two different classloaders cannot be cast.
Instead, inject the cache as instructed in https://github.com/infinispan/infinispan-quickstart/tree/master/jboss-as7 and you'd better off. You can inject the cache into an EJB too
-
3. Re: ClassCastException when accessing CacheManager in jBoss 7.1.1
viktor Jul 12, 2012 2:33 AM (in response to galder.zamarreno)Galder,
Thanx for the hint.
I've upgradeded to Java SE 7 to workaround the @Resource lookup problem and managed to deploy sample above to jBoss 7.1.1.
But when I try using it in my app in jBoss 7 - my injected cache is always null.
I miss something...I went as far as copying Resource.java and Controller.java from the sample as is into my app.
@Singleton
public class Resources {
.....
@SuppressWarnings("unused")
@Produces
@Resource(lookup="java:jboss/infinispan/container/jboss-as7-quickstart")// note that config is unchanged and works in quickstart
private static EmbeddedCacheManager container;
@SessionScoped
@Named
public class Controller implements Serializable {
@Inject
transient AdvancedCache<Object, Object> cache;
Still cache in controller null. No complains from jBoss when deploying.
I've copied most of the pom stuff in my pom....any hints what else needs to be done to get that elusive cache?