在我的Spring1.4应用程序中,我配置了以下缓存管理器:
@Bean
public CacheManager cacheManager() throws Exception {
JndiTemplate jndiTemplate = new JndiTemplate();
EmbeddedCacheManager embededCacheManager = (EmbeddedCacheManager) jndiTemplate.lookup("java:jboss/infinispan/container/CONTAINER");
SpringEmbeddedCacheManager cacheManager = new SpringEmbeddedCacheManager(embededCacheManager);
}我正在运行WildFly 10。
在pom.xml中,我为Infinispan定义了这个依赖项:
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-spring</artifactId>
<version>8.1.0.Final</version>
</dependency>当我部署应用程序Infinispan时,查找会找到WildFly配置中定义的缓存容器,一切都会正常启动。但是,当我运行使用缓存的方法时,我会得到以下异常:
java.lang.IncompatibleClassChangeError: Class org.jboss.as.clustering.infinispan.DefaultCache does not implement the requested interface org.infinispan.commons.api.BasicCache 造成这一错误的原因是什么,以及如何修复?
发布于 2016-11-14 07:48:14
好的,这就是解决这个问题的原因。我不得不在舱单上加上可靠的org.jboss.as.clustering.infinispan。因此,我的POM的maven-war-plugin定义如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.infinispan, org.infinispan.commons, org.jboss.as.clustering.infinispan export</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>https://stackoverflow.com/questions/40564680
复制相似问题