I'm trying to init CDI-SE context inside my Quartz Application, so i have the following dependency (maven):
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>2.3.4.Final</version>
</dependency>
Inside my JobQuartz i have the method execute() with the following:
public void execute(JobExecutionContext context) throws JobExecutionException {
Weld weld = new Weld();
WeldContainer container = weld.initialize();
service = container.instance().select(MyService.class).get();
service.go();
weld.shutdown();
}
But i got the following error:
Caused by: java.lang.IllegalStateException: WELD-ENV-002009: Weld SE container cannot be initialized - no bean archives found
My project is a WAR, so i putted beans.xml file inside /src/main/webapp/META-INF/
, see the content:
<?xml version="1.0"?>
<beans 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/beans_1_1.xsd"
version="1.2" bean-discovery-mode="all">
</beans>
I copied the file to /src/main/resource/META-INF
, but i got the same error.