In my process to migrate a working EAR application to JBoss AS 7.1.1-Finel I faced another problem what I can not solve. Shortly, an EJB3 looks up for a cache container and stores data in it.
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;
}
The EAR defines the dependency on infinispan in the jboss-deployment-structure.xml, in this way:
<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>
When I deploy this code I get the following error:
Caused by: java.lang.NoClassDefFoundError: org/infinispan/manager/CacheContainer
Could somebody help me?
Best regards, SK
This will only work for a top-level deployment, as described here. You may need to move the
org.infinispan
dependency to the relevantsub-deployment
section: