WildFly 8.2.0 and Infinispan 6.0.2 CacheContainer Injection error

3.9k Views Asked by At

I have searched the web to no end and tried many examples but simply cannot get a test example to work. Based on tutorials and examples out there, it should be working.
But I'm running out of ideas and hoping that someone can spot the issue.

Please help and lots of appreciation in advance.

//Configuration: WildFly 8.2.0 running on Eclipse Luna, Java 1.8, Ubuntu 14

Basically, its the IllegalArgumentException at injection point

Caused by: java.lang.IllegalArgumentException: Can not set org.infinispan.manager.EmbeddedCacheManager field com.swift.test.SimpleCache.container to org.jboss.as.clustering.infinispan.DefaultCacheContainer

//------------------File:SimpleCache.java
package com.swift.test;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.ejb.Startup;

import org.infinispan.Cache;
import org.infinispan.manager.EmbeddedCacheManager;
import org.jboss.logging.Logger;

@Singleton
@Startup
public class SimpleCache {
 private Logger log = Logger.getLogger(this.getClass().getName());

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

 private Cache<String, String> cache;

 public SimpleCache() {
  log.info("SimpleCache()---------------->");
 }

 @PostConstruct
 public void initCache() {
  log.info("initCache()---------------->");
  this.cache = container.getCache();
 }

 public String get(String key) {
  log.info("get(String key)------------->");
  return this.cache.get(key);
 }

 public void put(String key, String value) {
  log.info("put(String key, String value) --------------->");
  this.cache.put(key, value);
 }

}


//-----------------------File: HelloWorld.java
package com.swift.test;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.json.Json;
import javax.json.JsonObject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import org.jboss.logging.Logger;

@Path("/")
@ApplicationScoped
public class HelloWorld {
 private Logger log = Logger.getLogger(this.getClass().getName());

 @Inject
 Test2Cache test1Cache;

 @Inject
 private SimpleCache simpleCache;

 public HelloWorld() {
  log.info("HelloWorld()");
 }

 @GET
 @Path("/helloworld")
 @Produces({ "application/json" })
 public JsonObject helloWorld() {
  log.info("helloWorld()");
  simpleCache.put("ABC", "124");
  return Json.createObjectBuilder().add("result", "Hello World").build();
 }

 @GET
 @Path("/getHelp")
 @Produces({ "application/json" })
 public JsonObject getHelp() {
  log.info("getHelp()");

  //return Json.createObjectBuilder().add("help", test1Cache.getHelp("ABC") ).build();
  return Json.createObjectBuilder().add("help", "help is here").build();
 }
}


//--------------------File: Test2Cache.java
package com.swift.test;

import java.util.logging.Logger;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;

@Singleton
@Startup
public class Test2Cache {
 private Logger log = Logger.getLogger(this.getClass().getName());

 public Test2Cache() {
  log.info("Test2Cache()-------------->");
 }

 @PostConstruct
 public void postConstruct() {
  log.info("postConstruct()--------------->");
 }

}


//----------------------File: web.xml
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
 id="WebApp_ID" version="3.1">
 <display-name>Test2</display-name>
 <welcome-file-list>
  <welcome-file>index.html</welcome-file>
 </welcome-file-list>

 <servlet-mapping>
  <servlet-name>javax.ws.rs.core.Application</servlet-name>
  <url-pattern>/tutorial/*</url-pattern>
 </servlet-mapping>

</web-app>


//------------------------File: pom.xml
<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>
 <groupId>Test2</groupId>
 <artifactId>Test2</artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <packaging>war</packaging>
 <name>Test2</name>
 <description>Sample test</description>

 <url>http://wildfly.org</url>
 <licenses>
  <license>
   <name>Apache License, Version 2.0</name>
   <distribution>repo</distribution>
   <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
  </license>
 </licenses>

 <properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
  <version.jboss.spec.javaee.7.0>1.0.0.Final</version.jboss.spec.javaee.7.0>
  <version.compiler.plugin>3.1</version.compiler.plugin>
  <version.war.plugin>2.1.1</version.war.plugin>
  <maven.compiler.target>1.7</maven.compiler.target>
  <maven.compiler.source>1.7</maven.compiler.source>
 </properties>

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

 <dependencies>
  <dependency>
   <groupId>javax.enterprise</groupId>
   <artifactId>cdi-api</artifactId>
   <scope>provided</scope>
  </dependency>

  <dependency>
   <groupId>org.jboss.spec.javax.json</groupId>
   <artifactId>jboss-json-api_1.0_spec</artifactId>
   <scope>provided</scope>
  </dependency>

  <dependency>
   <groupId>org.jboss.resteasy</groupId>
   <artifactId>jaxrs-api</artifactId>
   <scope>provided</scope>
  </dependency>

  <dependency>
   <groupId>org.infinispan</groupId>
   <artifactId>infinispan-core</artifactId>
   <version>6.0.2.Final</version>
  </dependency>

 </dependencies>

 <build>
  <finalName>${project.artifactId}</finalName>
  <plugins>
   <plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>${version.war.plugin}</version>
    <configuration>
     <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
   </plugin>

   <plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>${version.wildfly.maven.plugin}</version>
   </plugin>
   <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${version.compiler.plugin}</version>
    <configuration>
     <source>${maven.compiler.source}</source>
     <target>${maven.compiler.target}</target>
    </configuration>
   </plugin>
  </plugins>
 </build>

 <profiles>
  <profile>
   <id>openshift</id>
   <build>
    <plugins>
     <plugin>
      <artifactId>maven-war-plugin</artifactId>
      <version>${version.war.plugin}</version>
      <configuration>
       <outputDirectory>deployments</outputDirectory>
       <warName>ROOT</warName>
       <failOnMissingWebXml>false</failOnMissingWebXml>

       <archive>
        <manifestEntries>
         <Dependencies>org.infinispan export</Dependencies>
         <Dependencies>org.infinispan.commons export</Dependencies>         
        </manifestEntries>
       </archive>

      </configuration>
     </plugin>
    </plugins>
   </build>
  </profile>
 </profiles>
</project>

//-----------------File: standalone.xml
//Everything default plus:

        <subsystem xmlns="urn:jboss:domain:infinispan:2.0">
            
          <!-- more default -->
            <cache-container name="myCache" default-cache="myCacheDb" start="EAGER">
                <local-cache name="myCacheDb" start="EAGER"/>
            </cache-container>

        </subsystem>


//-----------LOG OUT ----------
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
12:16:43,220 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
12:16:43,984 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
12:16:44,219 INFO  [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
12:16:48,318 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015014: Re-attempting failed deployment Test2.war
12:16:48,343 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found Test2.war in deployment directory. To trigger deployment create a file called Test2.war.dodeploy
12:16:48,428 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
12:16:48,517 INFO  [org.xnio] (MSC service thread 1-1) XNIO version 3.3.0.Final
12:16:48,552 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.3.0.Final
12:16:48,753 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
12:16:48,784 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
12:16:48,785 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
12:16:48,798 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
12:16:48,798 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.
12:16:48,822 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
12:16:48,934 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
12:16:48,962 INFO  [org.jboss.as.security] (MSC service thread 1-5) JBAS013170: Current PicketBox version=4.0.21.Final
12:16:49,102 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017502: Undertow 1.1.0.Final starting
12:16:49,116 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.6.Final
12:16:49,121 INFO  [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service
12:16:49,151 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
12:16:49,203 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-6) JBAS015400: Bound mail session [java:jboss/mail/Default]
12:16:49,295 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-6) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
12:16:49,516 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
12:16:49,587 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) JBAS010417: Started Driver service with driver-name = h2
12:16:49,859 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /home/hvu/Downloads/wildfly-8.2.0.Final/welcome-content
12:16:50,013 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017525: Started server default-server.
12:16:50,052 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS017531: Host default-host starting
12:16:51,163 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on testDev/testDev:8080
12:16:51,947 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "Test2.war" (runtime-name: "Test2.war")
12:16:51,956 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory /home/hvu/Downloads/wildfly-8.2.0.Final/standalone/deployments
12:16:52,284 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
12:16:52,713 INFO  [org.infinispan.factories.GlobalComponentRegistry] (ServerService Thread Pool -- 51) ISPN000128: Infinispan version: Infinispan 'Infinium' 6.0.2.Final
12:16:54,229 INFO  [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
12:16:54,476 INFO  [org.infinispan.jmx.CacheJmxRegistration] (ServerService Thread Pool -- 51) ISPN000031: MBeans were successfully registered to the platform MBean server.
12:16:54,501 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 51) JBAS010281: Started myCacheDb cache from myCache container
12:16:56,079 INFO  [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016002: Processing weld deployment Test2.war
12:16:56,328 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-8) HV000001: Hibernate Validator 5.1.3.Final
12:16:56,632 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings for session bean named Test2Cache in deployment unit deployment "Test2.war" are as follows:

 java:global/Test2/Test2Cache!com.swift.test.Test2Cache
 java:app/Test2/Test2Cache!com.swift.test.Test2Cache
 java:module/Test2Cache!com.swift.test.Test2Cache
 java:global/Test2/Test2Cache
 java:app/Test2/Test2Cache
 java:module/Test2Cache

12:16:56,641 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings for session bean named SimpleCache in deployment unit deployment "Test2.war" are as follows:

 java:global/Test2/SimpleCache!com.swift.test.SimpleCache
 java:app/Test2/SimpleCache!com.swift.test.SimpleCache
 java:module/SimpleCache!com.swift.test.SimpleCache
 java:global/Test2/SimpleCache
 java:app/Test2/SimpleCache
 java:module/SimpleCache

12:16:57,307 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016005: Starting Services for CDI deployment: Test2.war
12:16:57,448 INFO  [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900: 2.2.6 (Final)
12:16:57,591 INFO  [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016008: Starting weld service for deployment Test2.war
12:17:01,589 INFO  [com.swift.test.SimpleCache] (ServerService Thread Pool -- 51) SimpleCache()---------------->
12:17:01,597 INFO  [com.swift.test.Test2Cache] (ServerService Thread Pool -- 50) Test2Cache()-------------->
12:17:01,654 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 51) MSC000001: Failed to start service jboss.deployment.unit."Test2.war".component.SimpleCache.START: org.jboss.msc.service.StartException in service jboss.deployment.unit."Test2.war".component.SimpleCache.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
 at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_25]
 at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_25]
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
 at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
 at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
 at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:162)
 at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:133)
 at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:89)
 at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:122)
 at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:137)
 at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54)
 ... 6 more
Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: Can not set org.infinispan.manager.EmbeddedCacheManager field com.swift.test.SimpleCache.container to org.jboss.as.clustering.infinispan.DefaultCacheContainer
 at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:190)
 at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
 at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:369)
 at org.jboss.as.ejb3.tx.LifecycleCMTTxInterceptor.processInvocation(LifecycleCMTTxInterceptor.java:66)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)
 at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
 at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:160)
 ... 11 more
Caused by: java.lang.IllegalArgumentException: Can not set org.infinispan.manager.EmbeddedCacheManager field com.swift.test.SimpleCache.container to org.jboss.as.clustering.infinispan.DefaultCacheContainer
 at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) [rt.jar:1.8.0_25]
 at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) [rt.jar:1.8.0_25]
 at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) [rt.jar:1.8.0_25]
 at java.lang.reflect.Field.set(Field.java:758) [rt.jar:1.8.0_25]
 at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:108)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.weld.ejb.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:94)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
 at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
 at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273)
 ... 27 more

12:17:01,698 INFO  [com.swift.test.Test2Cache] (ServerService Thread Pool -- 50) postConstruct()--------------->
12:17:01,726 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "Test2.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"Test2.war\".component.SimpleCache.START" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Test2.war\".component.SimpleCache.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: Can not set org.infinispan.manager.EmbeddedCacheManager field com.swift.test.SimpleCache.container to org.jboss.as.clustering.infinispan.DefaultCacheContainer
    Caused by: java.lang.IllegalArgumentException: Can not set org.infinispan.manager.EmbeddedCacheManager field com.swift.test.SimpleCache.container to org.jboss.as.clustering.infinispan.DefaultCacheContainer"}}
12:17:01,884 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "Test2.war" (runtime-name : "Test2.war")
12:17:01,891 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."Test2.war".component.SimpleCache.START: org.jboss.msc.service.StartException in service jboss.deployment.unit."Test2.war".component.SimpleCache.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance

12:17:01,927 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://"localhost":9990/management
12:17:01,930 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://"localhost":9990
12:17:01,933 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.2.0.Final "Tweek" started (with errors) in 19688ms - Started 306 of 367 services (5 services failed or missing dependencies, 98 services are lazy, passive or on-demand)
12:17:02,253 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016009: Stopping weld service for deployment Test2.war
12:17:02,349 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment Test2.war (runtime-name: Test2.war) in 156ms
12:17:02,459 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "Test2.war" (runtime-name: "Test2.war")
12:17:02,465 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.deployment.unit."Test2.war".WeldBootstrapService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".WeldStartService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component.SimpleCache.START (missing) dependents: [service jboss.deployment.unit."Test2.war".moduleDeploymentRuntimeInformationStart, service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component.Test2Cache.START (missing) dependents: [service jboss.deployment.unit."Test2.war".moduleDeploymentRuntimeInformationStart, service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component."org.jboss.weld.servlet.WeldInitialListener".START (missing) dependents: [service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".component."org.jboss.weld.servlet.WeldTerminalListener".START (missing) dependents: [service jboss.deployment.unit."Test2.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./Test2, service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."Test2.war".moduleDeploymentRuntimeInformation (missing) dependents: [service jboss.deployment.unit."Test2.war".moduleDeploymentRuntimeInformationStart] 
      service jboss.undertow.deployment.default-server.default-host./Test2 (missing) dependents: [service jboss.deployment.unit."Test2.war".deploymentCompleteService] 
      service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./Test2] 
      service jboss.undertow.deployment.default-server.default-host./Test2.codec (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./Test2.UndertowDeploymentInfoService] 
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."Test2.war".component.SimpleCache.START

12:17:06,970 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found Test2.war in deployment directory. To trigger deployment create a file called Test2.war.dodeploy

2

There are 2 best solutions below

0
On

I ran into the same problem. I think it is because Wildfly ships with two implementations of Infinispan, one is Infinispan module under (modules/system/layers/base/org/infinispan) and other is Wildfly Clustering Infinispan module under (modules/system/layers/base/org/jboss/as/clustering/infinispan), it seems that Wildfly is using the second one.

What I´ve done (I couldn´t fixit yet) is adding the dependencies for the second module to my pom:

     <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-clustering-infinispan</artifactId>
        <version>8.2.0.Final</version>
        <scope>provided</scope>
     </dependency>

then added the dependency to MANIFEST:

Dependency: org.jboss.as.clustering.infinispan export

In your maven build profile you can export the org.jboss.as.clustering.infinispan to the the manifest file using the 'maven-war-plugin' plugin as follows:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <archive>
                    <manifestEntries>
                        <Dependencies>org.jboss.as.clustering.infinispan export</Dependencies>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

I think it is possible to tell (in the cache configuration) that you want to use another module, by adding the attribute "module" to your cache-container, but I couldn´t made it yet.

Hope it helps! Regards

0
On

For Wildfly 8.2 u have to add the following to make this work

<Dependencies>org.infinispan, org.infinispan.commons, org.jboss.as.clustering.infinispan export</Dependencies>