Attached please find a Maven project that reproduces the bug. I have used the Spring Boot Maven plugin within it only as a convenience mechanism: it builds an executable jar that locates application classes under BOOT-INF/classes. The program, such as it is, starts a CDI container and then immediately kills it. You'll note that the output of running this is:
LANELSON-mac:weld-2254 LANELSON$ `/usr/libexec/java_home -v 1.8`/bin/java -jar target/weld-2254-1.0.0-SNAPSHOT.jar |
Nov 03, 2016 7:38:35 AM org.jboss.weld.bootstrap.WeldStartup <clinit> |
INFO: WELD-000900: 3.0.0 (Alpha17) |
Exception in thread "main" java.lang.reflect.InvocationTargetException |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
at java.lang.reflect.Method.invoke(Method.java:498) |
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) |
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) |
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) |
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) |
Caused by: java.lang.IllegalStateException: WELD-ENV-002009: Weld SE container cannot be initialized - no bean archives found |
at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:915) |
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:757) |
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:176) |
at com.edugility.weld2254.Boot.main(Boot.java:15) |
... 8 more
|
With my fix, the output is, correctly:
LANELSON-mac:weld-2254 LANELSON$ `/usr/libexec/java_home -v 1.8`/bin/java -jar target/weld-2254-1.0.0-SNAPSHOT.jar |
Nov 03, 2016 7:46:42 AM org.jboss.weld.bootstrap.WeldStartup <clinit> |
INFO: WELD-000900: 3.0.0 (2016-11-02 21:54) |
Nov 03, 2016 7:46:42 AM org.jboss.weld.bootstrap.WeldStartup startContainer |
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. |
Nov 03, 2016 7:46:43 AM org.jboss.weld.environment.se.WeldContainer initialize |
INFO: WELD-ENV-002003: Weld SE container STATIC_INSTANCE initialized |
*** good morning! |
Nov 03, 2016 7:46:43 AM org.jboss.weld.environment.se.WeldContainer shutdown |
INFO: WELD-ENV-002001: Weld SE container STATIC_INSTANCE shut down
|
weld-2254.tar.gz |