Я пытаюсь запустить тест arquillian, тест использует бин, сопоставленный с аннотациями @Singleton и @Startup, внутри синглтона есть несколько типов кэша из infinispan, которые вводятся с помощью @Resource (lookup = "JNDI"), ошибка только говорит о том, что поля не могут быть установлены
Я уверен, что что-то упустил в моем классе Test. Это код класса и компонента.
@RunWith(Arquillian.class)
public class EJBsBeanTest {
private static SimpleDateFormat SDF_YYYYMMDD = new SimpleDateFormat("yyyy-MM-dd");
private Libreta lib;
private Documento documento;
private Documento documentoAdmin;
private Documento documentoRol;
@Deployment
public static Archive<?> createTestArchive() {
File[] files = Maven.resolver().loadPomFromFile("pom.xml")
.importRuntimeDependencies().resolve().withTransitivity().asFile();
WebArchive myArchive = ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(ConfigurationBean.class,... )
.addAsLibraries(files)
.addAsWebInfResource("jboss-deployment-structure.xml", ArchivePaths.create("jboss-deployment-structure.xml"))
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("META-INF/beans.xml"));
return myArchive;
}
}
............
@Startup
@Singleton
public class ConfigurationBean {
private static final Logger logger = Logger.getLogger(ConfigurationBean.class.getName());
private static Properties props;
private static IOException ioerror;
public static final String CACHE_RUA_CEIP = "evaluacionRuaCeip";
@Resource(lookup = "java:jboss/datagrid-infinispan/container/backend-manager/cache/externos-cache")
private Cache<String, Object> cacheExternos;
@Resource(lookup = "java:jboss/datagrid-infinispan/container/shiro-container")
private CacheContainer basicCacheContainer;
@Resource(lookup = "java:jboss/datagrid-infinispan/container/backend-manager/cache/permisosapp-cache")
private Cache<String, Object> cachePermisosApp;
@PostConstruct
public void init() {
try {
props = new Properties();
props.load(ConfigurationBean.class.getClassLoader().getResourceAsStream("ftp.properties"));
cachePermisosApp.clear();
cacheExternos.clear();
} catch (Exception ex) {
logger.log(Level.SEVERE, null, ex);
throw new RuntimeException(ex);
}
}
public Cache<String, Object> getCacheExternos() {
return cacheExternos;
}
public Properties getProps() {
return props;
}
public CacheContainer getBasicCacheContainer() {
return basicCacheContainer;
}
public Cache<String, Object> getCachePermisosApp() {
return cachePermisosApp;
}
}
И это ошибка:
org.jboss.arquillian.container.spi.client.container.DeploymentException:
Cannot deploy test.war: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"test.war\".component.ConfigurationBean.START" => "java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: WFLYEE0117: Field cacheExternos cannot be set - object of class org.infinispan.cache.impl.EncoderCache loaded by ModuleClassLoader for Module \"org.infinispan.core:ispn-9.4\" version 9.4.3.Final from local module loader @7776ab (finder: local module finder @79179359 (roots: /jboss/modules,/jboss/modules/system/layers/base,/jboss/modules/system/add-ons/ispn)) is not assignable to interface org.infinispan.Cache loaded by ModuleClassLoader for Module \"deployment.test.war\" from Service Module Loader
Caused by: java.lang.IllegalArgumentException: WFLYEE0117: Field cacheExternos cannot be set - object of class org.infinispan.cache.impl.EncoderCache loaded by ModuleClassLoader for Module \"org.infinispan.core:ispn-9.4\" version 9.4.3.Final from local module loader @7776ab (finder: local module finder @79179359 (roots: /jboss/modules,/jboss/modules/system/layers/base,/jboss/modules/system/add-ons/ispn)) is not assignable to interface org.infinispan.Cache loaded by ModuleClassLoader for Module \"deployment.test.war\" from Service Module Loader"}}}}