dev@jersey.java.net

Re: [Jersey] Difficulties getting the new CDI impl to work with the sample

From: Roberto Chinnici <roberto.chinnici_at_oracle.com>
Date: Fri, 13 Aug 2010 12:17:10 -0700

Yes, it works fine inside a web app.

Paul Sandoz wrote:
> I tried a very simple web app (attached) than emulates what Jersey
> does but logging output shows the the CDIExtension is not proxied when
> a reference is obtained from the BeanManager.
>
> Paul.
>
>
>
> On Aug 12, 2010, at 3:09 PM, Paul Sandoz wrote:
>
>> I am getting the same error on the latest nightly as well:
>>
>> http://dlc.sun.com.edgesuite.net/glassfish/v3.1/nightly/glassfish-3.1-b16-08_11_2010.zip
>>
>>
>> Paul.
>>
>> On Aug 12, 2010, at 2:39 PM, Paul Sandoz wrote:
>>
>>> Hi Roberto,
>>>
>>> I am getting some odd errors when deploying the CDI sample (i needed
>>> to modify it to add a beans.xml) with the latest version of Jersey
>>> copied into GlassFish promoted build 15.
>>>
>>> When i deploy i am getting an NPE in the CDIExtension class at:
>>>
>>> void lateInitialize() {
>>> // NPE here because toBeInitializedLater is null
>>> for (InitializedLater object : toBeInitializedLater) {
>>> object.later();
>>> }
>>> }
>>>
>>> I verified that the CDIExtension appears to be behaving as required
>>> via the log messages i.e. the before bean discovery event occurs:
>>>
>>> void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event) {
>>> initialize();
>>>
>>> // turn JAX-RS injection annotations into CDI qualifiers
>>> for (Class<? extends Annotation> qualifier :
>>> knownParameterQualifiers) {
>>> event.addQualifier(qualifier);
>>> }
>>> }
>>>
>>> I also verified that the value of the CDIExtension.toString is the
>>> same for the instance that is created and the instance that is
>>> looked up using the BeanManager:
>>>
>>> public void onWebApplicationReady() {
>>> CDIExtension extension = Utils.getInstance(beanManager,
>>> CDIExtension.class);
>>>
>>> extension.lateInitialize();
>>> }
>>>
>>>
>>> However the concrete class is of CDIExtension of the reference that
>>> is looked up via BeanManager is:
>>>
>>> class com.sun.jersey.server.impl.cdi.CDIExtension_$$_WeldProxy
>>>
>>> I suspect that weld proxying is not working correctly and the method
>>> calls on the proxy reference are not being correctly delegated to
>>> the proxied instance.
>>>
>>> I will try the latest nightly build.
>>>
>>> Paul.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net