Joseph Snyder commented on Bug WELD-1175

There is definitely a bug in GlassFish, not specific to Jersey, which I am in the process of fixing. There also appears to be a bug in Weld. Here are the steps to reproduce the bug (I will attach a test ear and sources):

  • Define a portable extension and package it in a jar.
  • Create multiple web apps.
  • Define an injection point to the portable extension in some class in each of the web apps.
  • Package the jar into each web app's WEB-INF/lib directory.
  • Package the web apps into an Ear and deploy the ear.
    After successfully deploying the app you must force the injection of the portable extension into another class for both of the wars. For the attached test app execute the folowing urls:
    http://localhost:8080/war1/MultiwarWar1Servlet
    http://localhost:8080/war2/MultiwarWar2Servlet
    One of these will cause the following:

[#|2012-10-05T12:36:57.908-0400|WARNING|44.0|javax.enterprise.web|_ThreadID=13;_ThreadName=http-listener-1(2);_TimeMillis=1349455017908;_LevelValue=900;|StandardWrapperValve[MultiwarWar2Servlet]: PWC1382: Allocate exception for servlet MultiwarWar2Servlet
java.lang.IllegalArgumentException: Can not set multiwar_lib.MultiwarExtension field multiwar_war2.MultiwarWar2Servlet.multiwarExtension to multiwar_lib.MultiwarExtension
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
at java.lang.reflect.Field.set(Field.java:657)
at org.jboss.weld.introspector.jlr.WeldFieldImpl.set(WeldFieldImpl.java:88)
at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:120)

...

I looked into the Weld code and it appears that AbstractContainerEvent.fire(...) is filling a Set of ObserverMethod objects. The key for the set is the id of the ObserverMethod object. The id being returned for the portable extension is the same for both wars in which the PE is contained so that the set only contains one ObserverMethod instead of 2.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira