2
在將正在工作的EAR應用程序遷移到JBoss AS 7.1.1-Finel的過程中,我遇到了另一個我無法解決的問題。不久之後,EJB3將查找緩存容器並在其中存儲數據。訪問Infinispan緩存容器失敗
org.infinispan.manager.CacheContainer container = null;
...
public static CacheContainer getCacheContainer() {
if(container == null) {
try {
Context ctx = new InitialContext();
container = (CacheContainer) ctx
.lookup("java:jboss/infinispan/container/mycache");
} catch (NamingException e) {
e.getCause();
}
}
return container;
}
耳朵定義了在JBoss部署-structure.xml Infinispan的依賴,以這樣的方式
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate" slot="main" />
<module name="org.infinispan" slot="main" />
<module name="org.jboss.as.clustering.infinispan" />
</dependencies>
</deployment>
</jboss-deployment-structure>
當我部署此代碼,我得到以下錯誤:
Caused by: java.lang.NoClassDefFoundError: org/infinispan/manager/CacheContainer
有人能幫助我嗎?
最好的問候, SK
謝謝Szymon,是解決我的問題。 –
謝謝,這非常有幫助。但是,不應該將其作爲全球依賴項,例如就像我們用org.hibernate.commons-annotations等?您鏈接的文檔中說,部署依賴關係是全局的,就像它們被添加到清單中一樣(這正是Infinispan文檔所建議的)。對此有何想法? – Thomas
@Thomas我不確定我是否理解正確,但是如果您指的是_Global Modules_部分,那麼是的 - 它也應該在該級別上工作。但請記住,這與'jboss-deployment-structure.xml'不相關,因爲''部分放在應用服務器配置中(例如'standalone.xml'),而不是部署描述符本身。 –