[GLASSFISH-18802] Wrong beans.xml associated with bean deployment archive Created: 13/Jun/12 Updated: 29/Mar/13 Resolved: 29/Mar/13
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
Windows 7 64 bit
I had an issue whith interceptor activation for CDI beans. I investigated the issue and found that GlassFish associates wrong beans.xml resource with bean deployment archives. This causes Weld to think that interceptors for BDA are not enabled because provided beans.xml has no interceptors enabled (although beans.xml in BDA has them enabled).
The cause of this is the way GlassFish constructs URL for beans.xml which is then passed to org.jboss.weld.bootstrap.WeldBootstrap.
In case of web application with multiple bean archives located in WEB-INF/lib it loads the same beans.xml for all bean archives (the first one found). That's beacuse there is one class loader for whole web application. There are no separate classloaders for specific archives in WEB-INF/lib. The entry in all cases is "META-INF/beans.xml", so the classloader always loads the same resource.
I attached a test case which demonstrates this bahaviour.
makes it pass.
|Comment by pgliznie [ 11/Jul/12 ]|
We have the same issue. Our EAR has the following structure:
Our Interceptor and InterceptorBinding are in ejb.jar. The interceptor is enabled in beans.xml in web-app1.war and there is the class annotated which method calls we try to intercept. The application starts, there are no errors but the interceptor doesn't work. Changing the enabled interceptor in beans.xml to some non-existant class doesn't produce error messages. Only adding any interceptor to the beans.xml in beans1.jar works - it seems only this beans.xml is loaded.
|Comment by thilian [ 08/Aug/12 ]|
We experience a similar thing in 3.1.1.
All are bean archives.
We have an interceptor with binding defined in beans.jar. It is also enabled in beans.xml of beans.jar. We have interceptor binding annotations on beans in all archives, and they all work, even though they are not enabled in any other beans.xml.
We now created a new interceptor with binding defined in ejb1.jar. We enabled it in ejb1.jar's beans.xml, but it it totally ignored. Only the interceptor enabled in beans.jar in actually working, regadless of what we write in ejb1.jar's beans.xml.
|Comment by Piotr Kulasek [ 07/Feb/13 ]|
I have found something similar but in my case I had to enable interceptor in all bean archives under META-INF/lib.
|Comment by jwells [ 29/Mar/13 ]|
This must have been fixed as part of other fixes.
I have a test case under:
that demonstrates that this is currently working. It has two EJBs in an EAR and each EJB has a different interceptor defined in beans.xml. Both interceptors work properly. If the described behavior above were still in the product then only one of the interceptors would have been seen.