引起:java.lang.ClassNotFoundException:org.infinispan.commons.CacheException

时间:2018-01-11 17:06:46

标签: caching wildfly infinispan

我正在尝试将jboss 4升级到jboss 7并使用wildfly 10进行研究。

现在我说错误了

  

引起:java.lang.ClassNotFoundException:   来自[Module。的org.infinispan.commons.CacheException   " deployment.mes-webservices.ear:主"来自服务模块加载器]

     

在   org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)

     

在   org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

     

在   org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)

     

在   org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

     

... 299更多

当我调试时,我看到这里发生了错误。

cachedBom = (BillOfMaterials) **CacheManager**.fetchObjectFromCache(bomFqn, bomKey);

这里指的是cacheManager。

private static final String CACHENAME = "ClusteredTreeCache";

protected static final Log log = LogFactory.getLog(CacheManager.class);

private static  EmbeddedCacheManager   myCacheManager;

private  static Cache cache = myCacheManager.getCache();

private static  TreeCache  mCache;



private static void findCache() throws MalformedObjectNameException

{





    // Find the shared cache service in JMX and create a proxy to it

ObjectName cacheServiceName_ = new ObjectName("java:jboss/infinispan/replicated_cache/customer");

// Create Proxy-Object for this service

myCacheManager = new DefaultCacheManager();



mCache = new TreeCacheFactory().createTreeCache(cache);



// Log that medtronicCache Proxy saved

log.info("mCache Proxy Object has been set.   Should only happen once.");

}

Standalone :
 <cache-container name="replicated_cache" default-cache="default" module="org.wildfly.clustering.server" jndi-name="infinispan/replicated_cache">
                <transport lock-timeout="60000"/>
                <replicated-cache name="customer" jndi-name="infinispan/replicated_cache/customer" mode="SYNC">
                    <transaction locking="OPTIMISTIC" mode="NON_XA"/>
                    <eviction strategy="NONE"/>
                </replicated-cache>
            </cache-container>

1 个答案:

答案 0 :(得分:1)

问题似乎是org.infinispan.commons.CacheException不在您的运行时类路径中。请检查:

  • infinispan-commons.jar是部署的一部分
  • 或者你有jboss-deployment-structure.xml声明了对org.infinispan.commons模块的依赖
  • 或者您对org.infinispan.commons模块有明显的依赖性

您可以在Gitlab上查看我的demo project