java.lang.NoClassDefFoundError: Lorg/infinispan/manager/EmbeddedCacheManager

Please help. I am trying to do a simple cache mechanism using Jboss 8.1.0 cache functionality. This is how I had implemented the project structure:

The pomn file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>21</version>
        <relativePath />
    </parent>

    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-web-7.0</artifactId>
    <version>1.1.0.Final</version>
    <packaging>pom</packaging>

    <name>JBoss Java EE 7 Web Profile APIs</name>
    <description>JBoss Java EE 7 Web Profile APIs</description>

    <url>http://jboss.org/infinispan</url>
    <licenses>
        <license>
            <name>GNU Lesser General Public License</name>
            <url>http://www.gnu.org/copyleft/lesser.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <!-- Explicitly declaring the source encoding eliminates the following 
            message: -->
        <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered 
            resources, i.e. build is platform dependent! -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <version.jboss.javaee.web>2.0.0.Final</version.jboss.javaee.web>
        <infinispan.version>6.0.2.Final</infinispan.version>
    </properties>

    <scm>
        <connection>scm:git:[email protected]:jboss/jboss-javaee-specs.git</connection>
        <developerConnection>scm:git:[email protected]:jboss/jboss-javaee-specs.git</developerConnection>
        <url>https://github.com/jboss/jboss-javaee-specs</url>
        <tag>jboss-javaee-7.0-1.1.0.Final</tag>
    </scm>

    <issueManagement>
        <system>jira</system>
        <url>http://jira.jboss.com/jira/browse/JBEE</url>
    </issueManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-7.0</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- External JavaEE spec APIs (not part of the JBoss JavaEE Specs project) -->
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
        </dependency>

        <!-- JBoss JavaEE API Specs Projects -->
        <dependency>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ejb</groupId>
            <artifactId>jboss-ejb-api_3.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.el</groupId>
            <artifactId>jboss-el-api_3.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.faces</groupId>
            <artifactId>jboss-jsf-api_2.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.interceptor</groupId>
            <artifactId>jboss-interceptors-api_1.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.json</groupId>
            <artifactId>jboss-json-api_1.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.resource</groupId>
            <artifactId>jboss-connector-api_1.7_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.1_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.servlet.jsp</groupId>
            <artifactId>jboss-jsp-api_2.3_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.taglibs</groupId>
            <artifactId>taglibs-standard-spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.transaction</groupId>
            <artifactId>jboss-transaction-api_1.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.websocket</groupId>
            <artifactId>jboss-websocket-api_1.1_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ws.rs</groupId>
            <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.xml.bind</groupId>
            <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
        </dependency>

        <!-- JBoss JavaEE API Specs Projects -->
        <dependency>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ejb</groupId>
            <artifactId>jboss-ejb-api_3.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.el</groupId>
            <artifactId>jboss-el-api_3.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.faces</groupId>
            <artifactId>jboss-jsf-api_2.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.interceptor</groupId>
            <artifactId>jboss-interceptors-api_1.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.json</groupId>
            <artifactId>jboss-json-api_1.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.resource</groupId>
            <artifactId>jboss-connector-api_1.7_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.1_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.servlet.jsp</groupId>
            <artifactId>jboss-jsp-api_2.3_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.taglibs</groupId>
            <artifactId>taglibs-standard-spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.transaction</groupId>
            <artifactId>jboss-transaction-api_1.2_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.websocket</groupId>
            <artifactId>jboss-websocket-api_1.1_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ws.rs</groupId>
            <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.xml.bind</groupId>
            <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
        </dependency>



    </dependencies>


    <build>
        <!-- Set the name of the war, used as the context root when the app is 
            deployed -->
        <finalName>infinispan-jboss-as7</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <archive>
                        <manifestEntries>
                            <Dependencies>org.infinispan export</Dependencies>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <!-- JBoss AS plugin to deploy war -->
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.1.1.Final</version>
            </plugin>

            <!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation 
                processors -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Dependencies>org.infinispan export</Dependencies>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>

</project>

And a picture with the rest of the dependencies, sorry for adding them like this (bad practice). I had those on my local drive.

The rest of the dependencies

The project facets:

project facets

The standalone.xml file:

           <subsystem xmlns="urn:jboss:domain:infinispan:2.0">
        <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
            <local-cache name="passivation" batching="true">
                <file-store passivation="true" purge="false"/>
            </local-cache>
            <local-cache name="persistent" batching="true">
                <file-store passivation="false" purge="false"/>
            </local-cache>
        </cache-container>
        <cache-container name="ejb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan" aliases="sfsb">
            <local-cache name="passivation" batching="true">
                <file-store passivation="true" purge="false"/>
            </local-cache>
            <local-cache name="persistent" batching="true">
                <file-store passivation="false" purge="false"/>
            </local-cache>
        </cache-container>
        <cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
            <local-cache name="entity">
                <transaction mode="NON_XA"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="local-query">
                <transaction mode="NONE"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="timestamps">
                <transaction mode="NONE"/>
                <eviction strategy="NONE"/>
            </local-cache>
        </cache-container>
        <cache-container name="jboss-as7-quickstart" default-cache="my_local_cache">
            <local-cache name="entity">
                <transaction mode="NON_XA"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="my_local_cache">
                <transaction mode="NONE"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="timestamps">
                <transaction mode="NONE"/>
                <eviction strategy="NONE"/>
            </local-cache>
        </cache-container>
    </subsystem>

The java code for the server:

import java.io.IOException;

import javax.annotation.Resource;
import javax.enterprise.inject.Produces;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.infinispan.Cache;
import org.infinispan.manager.EmbeddedCacheManager;

import javax.enterprise.context.ApplicationScoped;



@WebServlet("/TestCache")
public class TestCache extends HttpServlet {
    private static final long serialVersionUID = 1L;

    @Produces
    @ApplicationScoped
    @Resource(lookup = "java:jboss/infinispan/container/jboss-as7-quickstart")
    private static EmbeddedCacheManager container;


    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        Cache<String, Object> localCache = container.getCache();
    }

}

And the log with the error:

11:05:18,748 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
11:05:19,170 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
11:05:19,309 INFO  [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.1.0.CR2 "Kenny" starting
11:05:21,368 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found infinispan-cdi.war in deployment directory. To trigger deployment create a file called infinispan-cdi.war.dodeploy
11:05:21,405 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
11:05:21,446 INFO  [org.xnio] (MSC service thread 1-1) XNIO version 3.2.2.Final
11:05:21,462 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.2.2.Final
11:05:21,528 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
11:05:21,531 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
11:05:21,540 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
11:05:21,542 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
11:05:21,545 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
11:05:21,548 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
11:05:21,554 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013170: Current PicketBox version=4.0.21.Beta1
11:05:21,558 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-13) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.5.Final)
11:05:21,645 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.0.10.Final starting
11:05:21,645 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
11:05:21,648 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-15) JBAS017502: Undertow 1.0.10.Final starting
11:05:21,653 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = h2
11:05:21,775 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
11:05:21,775 INFO  [org.jboss.as.naming] (MSC service thread 1-14) JBAS011802: Starting Naming Service
11:05:22,036 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)
11:05:22,039 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-15) JBAS010417: Started Driver service with driver-name = ojdbc6
11:05:22,354 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.3.Final
11:05:22,380 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path E:/Ditech/MORE/PPN
11:05:22,410 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path E:\Ditech\MORE\Server\JBoss\JBoss/docs
11:05:22,427 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-11) JBAS017525: Started server default-server.
11:05:22,464 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017531: Host default-host starting
11:05:22,635 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:8080
11:05:22,873 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-9) JBAS015012: Started FileSystemDeploymentService for directory E:\Ditech\MORE\Server\JBoss\JBoss\standalone\deployments
11:05:22,877 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "infinispan-cdi.war" (runtime-name: "infinispan-cdi.war")
11:05:22,893 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-16) JBAS010400: Bound data source [java:jboss/jdbc/PpnDS]
11:05:22,894 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) JBAS010400: Bound data source [java:jboss/jdbc/PUDS]
11:05:22,895 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
11:05:23,600 INFO  [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final
11:05:24,777 INFO  [org.jboss.weld.deployer] (MSC service thread 1-15) JBAS016002: Processing weld deployment infinispan-cdi.war
11:05:24,912 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-15) HV000001: Hibernate Validator 5.1.0.Final
11:05:25,204 INFO  [org.jboss.weld.deployer] (MSC service thread 1-12) JBAS016005: Starting Services for CDI deployment: infinispan-cdi.war
11:05:25,272 INFO  [org.jboss.weld.Version] (MSC service thread 1-12) WELD-000900: 2.1.2 (Final)
11:05:25,337 INFO  [org.jboss.weld.deployer] (MSC service thread 1-11) JBAS016008: Starting weld service for deployment infinispan-cdi.war
11:05:25,788 WARN  [org.jboss.weld.Event] (MSC service thread 1-14) WELD-000411: Observer method [BackedAnnotatedMethod] org.infinispan.cdi.util.defaultbean.DefaultBeanExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
11:05:27,678 INFO  [org.infinispan.cdi.util.defaultbean.DefaultBeanExtension] (MSC service thread 1-14) Preventing install of default bean Producer Method [Configuration] with qualifiers [@Synthetic @Any] declared as [[UnbackedAnnotatedMethod] @Produces @DefaultBeanInformation @ConfigureCache @Synthetic @DefaultBean public org.infinispan.cdi.DefaultEmbeddedCacheConfigurationProducer.getDefaultEmbeddedCacheConfiguration(@OverrideDefault Instance<Configuration>)]
11:05:28,319 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-8) Initializing Mojarra 2.2.6-jbossorg-4 20140501-1134 for context '/infinispan-cdi'
11:05:29,683 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017534: Registered web context: /infinispan-cdi
11:05:29,783 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "infinispan-cdi.war" (runtime-name : "infinispan-cdi.war")
11:05:29,930 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://0.0.0.0:9990/management
11:05:29,932 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://0.0.0.0:9990
11:05:29,933 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.CR2 "Kenny" started in 11766ms - Started 307 of 374 services (115 services are lazy, passive or on-demand)
11:05:39,866 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found CacheTest6.war in deployment directory. To trigger deployment create a file called CacheTest6.war.dodeploy
11:05:39,888 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "CacheTest6.war" (runtime-name: "CacheTest6.war")
11:05:39,966 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-16) MSC000001: Failed to start service jboss.deployment.unit."CacheTest6.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."CacheTest6.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "CacheTest6.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.CR2.jar:8.1.0.CR2]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_131]
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class test.TestCache with ClassLoader ModuleClassLoader for Module "deployment.CacheTest6.war:main" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72) [wildfly-server-8.1.0.CR2.jar:8.1.0.CR2]
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.CR2.jar:8.1.0.CR2]
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: Lorg/infinispan/manager/EmbeddedCacheManager;
    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.8.0_131]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583) [rt.jar:1.8.0_131]
    at java.lang.Class.getDeclaredFields(Class.java:1916) [rt.jar:1.8.0_131]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [wildfly-server-8.1.0.CR2.jar:8.1.0.CR2]
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68) [wildfly-server-8.1.0.CR2.jar:8.1.0.CR2]
    ... 10 more
Caused by: java.lang.ClassNotFoundException: org.infinispan.manager.EmbeddedCacheManager from [Module "deployment.CacheTest6.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
    ... 15 more

11:05:39,988 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "CacheTest6.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"CacheTest6.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"CacheTest6.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"CacheTest6.war\"
    Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class test.TestCache with ClassLoader ModuleClassLoader for Module \"deployment.CacheTest6.war:main\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: Lorg/infinispan/manager/EmbeddedCacheManager;
    Caused by: java.lang.ClassNotFoundException: org.infinispan.manager.EmbeddedCacheManager from [Module \"deployment.CacheTest6.war:main\" from Service Module Loader]"}}
11:05:40,103 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "CacheTest6.war" (runtime-name : "CacheTest6.war")
11:05:40,120 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."CacheTest6.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."CacheTest6.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "CacheTest6.war"

Upvotes: 1

Views: 3356

Answers (1)

Finally, I had figured it out after one day and a half. This is the new implementation that works for me:

The pomn file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>infinispan-simple-tutorials-jcache</artifactId>
    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>21</version>
        <relativePath />
    </parent>
    <name>Infinispan Simple Tutorials: JCache</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>java</executable>
                    <arguments>
                        <argument>-Djava.net.preferIPv4Stack=true</argument>
                        <argument>-Djava.util.logging.config.file=src/main/resources/logging.properties</argument>
                        <argument>-classpath</argument>
                        <classpath />
                        <argument>org.infinispan.tutorial.simple.jcache.InfinispanJCache</argument>
                    </arguments>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I had added the jar files that exists in Jboss folder, (Gest search for them) for me this path is

[jboss-folder]\standalone\tmp\vfs\deployment\deployment1d3f5df834f24586\

and from here you must have a reference to almost all the jar files the folders. Here is my example of what I had imported in the project:Adding Jboss Librarys

Please don't forget to add a reference to poi jar to don't get violated resource access errors.

Now for some reason, I was getting that error because the war file didn't had the jar files inside it. So I had to copy manually all the jars that are added to the project in the lib folder of the war file.Adding manually the jars in the war file

And finally the java part:

import java.io.IOException;
import java.util.Date;

import javax.annotation.Resource;
import javax.cache.CacheManager;
import javax.cache.Caching;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.expiry.AccessedExpiryPolicy;
import javax.cache.expiry.Duration;
import javax.enterprise.inject.Produces;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.infinispan.manager.CacheContainer;
import org.infinispan.manager.EmbeddedCacheManager;

@WebServlet("/TestCache")
public class TestCache extends HttpServlet {
    private static final long serialVersionUID = 1L;

/*  @Resource(lookup = "java:jboss/infinispan/container/jboss-as7-quickstart")
    private EmbeddedCacheManager container;*/

    @Resource(lookup = "java:jboss/infinispan/container/myCache")
    private CacheContainer container; 

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/*      CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
        MutableConfiguration<String, Date> config = new MutableConfiguration<String, Date>();

        config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(Duration.FIVE_MINUTES)).setStatisticsEnabled(true);
        cacheManager.createCache("simpleCache",config);
        javax.cache.Cache<String, Long> localCache= cacheManager.getCache("simpleCache");*/

        System.out.println(container.toString());
    }
}

And to don't forghet the jboss standalone.xml file:

  <subsystem xmlns="urn:jboss:domain:infinispan:2.0">
        <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
            <local-cache name="passivation" batching="true">
                <file-store passivation="true" purge="false"/>
            </local-cache>
            <local-cache name="persistent" batching="true">
                <file-store passivation="false" purge="false"/>
            </local-cache>
        </cache-container>
        <cache-container name="ejb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan" aliases="sfsb">
            <local-cache name="passivation" batching="true">
                <file-store passivation="true" purge="false"/>
            </local-cache>
            <local-cache name="persistent" batching="true">
                <file-store passivation="false" purge="false"/>
            </local-cache>
        </cache-container>
        <cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
            <local-cache name="entity">
                <transaction mode="NON_XA"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="local-query">
                <transaction mode="NONE"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="timestamps">
                <transaction mode="NONE"/>
                <eviction strategy="NONE"/>
            </local-cache>
        </cache-container>
        <cache-container name="jboss-as7-quickstart" default-cache="my_local_cache">
            <local-cache name="entity">
                <transaction mode="NON_XA"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="my_local_cache">
                <transaction mode="NONE"/>
                <eviction strategy="LRU" max-entries="10000"/>
                <expiration max-idle="100000"/>
            </local-cache>
            <local-cache name="timestamps">
                <transaction mode="NONE"/>
                <eviction strategy="NONE"/>
            </local-cache>
        </cache-container>
        <cache-container name="myCache" default-cache="cachedb">
            <local-cache name="cachedb"/>
        </cache-container>
    </subsystem>

Result:enter image description here

P.S. Thanks "AKSW" for the implication in this problem.

Upvotes: 1

Related Questions