Weld-SE inter-module lookups failing when application started from IDEA

Here is a simple maven multi-module folder using the Weld SE implementation.

The application is started the usual way, with the "org.jboss.weld.environment.se.StartMain" main method, and a bean ("TestCDI", located in the "some-jar" module) listening on the "ContainerInitialized" event.

The listener bean only action is to perform a lookup to the bean "AnotherJarBean" located in the other maven module ("another-jar").

To build and start the app:
$ mvn clean package
$ cd some-jar/target
$ java -cp "some-jar-1.0-SNAPSHOT.jar:lib/*" org.jboss.weld.environment.se.StartMain
INFO: WELD-000900: 2.2.1 (Final)
Jun 06, 2014 12:59:33 PM 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.
Jun 06, 2014 12:59:33 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit>
WARN: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
Jun 06, 2014 12:59:33 PM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit>
WARN: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
Started, attempt lookup:
com.test.another.AnotherJarBean@5ffead27


So far, so good.

Now, when starting the same main class from within IDEA (and more verbose logging), despite all beans being correctly detected, the lookup fails, see: https://gist.github.com/anonymous/8d9a530f1f23163a032a

However, this behaviour is not 100% consistent. When arranging the code differently (eg. by starting the Weld container manually in my own main method), then the lookup is sometimes successful (it may for example works 10 times in a row, and then fail for another 10 times). With this particular setup, the problem seems however to be always happening (I'm running a 1.7 JDK on Linux with IDEA 13.1.3).

I found two ways to work around this problem so far:
- Ignoring the module hosting the CDI bean (using then the module from the local repo).
- Setting the "org.jboss.weld.se.archive.isolation" system property to "false".

Both of these methods have obvious shortcomings.

I've never reproduced this when starting the application from a terminal, or with a non-maven project. So, I guess that it is somehow related to the maven plugin.

Any idea? Should I report this?

Thanks,
Jean



Attachment(s):
test-cdi.tar.gz

Please sign in to leave a comment.