]
Pete Muir commented on WELD-712:
--------------------------------
Test pushed to
Regression in Extension proxy method invocations
------------------------------------------------
Key: WELD-712
URL:
https://jira.jboss.org/browse/WELD-712
Project: Weld
Issue Type: Bug
Components: GlassFish Integration, Proxies, Reflection layer
Affects Versions: 1.1.0.Beta1
Environment: Latest GlassFish that has 1.1.0-01-glassfish build of Weld
integrated. To reproduce the problem the following system property needs to be set to
bypass the Jersey workaround for this issue.
<jvm-options>-Dcom.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=true</jvm-options>
Reporter: Sivakumar Thyagarajan
Labels: extension, observer, observes, proxy
Fix For: 1.1.0.CR1
Attachments: 13131-analysis.txt, relevant-jersey-sources.tar.bz2
Glassfish issue 13131 [1], involving the Jersey portable extension, notes that there has
been a regression in the last integration of Weld (1.1.0-01-glassfish).
It appears that invocations on observer methods of container lifecycle events are handled
in the proxy and delegated to the proxied instance of the Extension, whereas invocations
of non-observer methods on a Extension that is obtained from BeanManager, are directed
towards the non-proxied instance of the Extension. This behaviour appears to have been
changed after Weld 1.0
More details:
The Jersey extension has a private initialization method (initialize() [2]) that inits
the state of the extension during beforeBeanDiscovery. I notice that there are two
instances of the Extension being created (because the extension is being proxied) -- let
us call it actual_instance1 and proxy_instance_2.
beforeBeanDiscovery observer method is called on proxy_instance_2 and this method call in
turn delegates to actual_instance1 and initialize() method is called on actual_instance1.
So now actual_instance1's state is initialized correctly.
However later when the Extension is looked up through the BeanManager elsewhere [3], the
proxy_instance_2 is returned. When a non-observer method (lateInitialize [4]) is called on
this instance proxy_instance_2, this method call goes to proxy_instance_2 and is not
forwarded to actual_instance_1. Since the state is not initialized in proxy_instance_2,
this call fails.
Please see the attached text file for stack traces related to the various stages
discussed above and also contact me should you need to reproduce this.
[1]
http://glassfish.dev.java.net/issues/show_bug.cgi?id=13131
[2] intialize method in
https://jersey.dev.java.net/svn/jersey/trunk/jersey/jersey-server/src/mai...
[3] constructor in CDIComponentProviderFactory looks up the Extension using the
BeanManager
https://jersey.dev.java.net/svn/jersey/trunk/jersey/jersey-server/src/mai...
[4] lateInitialize in
https://jersey.dev.java.net/svn/jersey/trunk/jersey/jersey-server/src/mai...
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: