one beans.xml for all subdeployments possible?
klauskinski Jul 2, 2013 3:23 AMHi,
I have one EAR file containing multiple jar files below lib/.
In the past all the jar files in lib/ which are providing beans contained a beans.xml and it worked fine.
Now I need several jar files also for another application which uses Spring and not CDI. Because of that, the beans.xml is now a problem as weld (which is starting automatically during the JBoss deployment) is conflicting with spring.
The plan is now to remove the beans.xml files from each jar file and only have one beans.xml file in the encapsulating ear file for the CDI applications handling the beans creation with Weld of all subdeployments.
But - it is not working.
I placed the beans.xml below META-INF/ of the ear but it looks like no beans are created from the subdeployments:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:weld="http://jboss.org/schema/weld/beans"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd
http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd">
<interceptors>
<class>de.poc.jee.CacheInterceptor</class>
</interceptors>
<weld:scan>
<weld:include name="de.poc.**" />
</weld:scan>
</beans>
The structure is:
EAR/lib/jar1.jar
EAR/lib/jar2.jar
EAR/lib/jarn.jar
EAR/META-INF/maven/...../pom.xml
EAR/META-INF/maven/...../pom.properties
EAR/META-INF/application.xml
EAR/META-INF/beans.xml
EAR/META-INF/jboss-ejb-client.xml
EAR/META-INF/MANIFEST.MF
EAR/plugin.jar
EAR/main.jar
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ICacheManager] with qualifiers [@Default] at injection point [[field] @Inject private de.poc.whatever.api.handler.AbstractRequestHandler.cacheManager]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:143)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)