Hi Romain,

You can find my code at https://github.com/kalgon/jaxb-cdi-test

I've stripped my extension down to the minimum (I removed the scanning and I am 
just instantiating an empty JAXBContext).

It seems that OWB wants to use the JAXBContext ClassLoader (which is null).

The problem could also come from an incorrect use of the BeanBuilder (but that 
extension works well in wildfly, it only fails in my tests with OpenEJB).

Thanks,

Xavier

----------------------------------------
> From: [email protected]
> Date: Mon, 15 Feb 2016 17:36:17 +0100
> Subject: Re: NPE when creating a bean through Extension and not through 
> Producer
> To: [email protected]
>
> Hi Xavier,
>
> do you have some code to share - hope google didnt eat any snippet again?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2016-02-15 16:47 GMT+01:00 Xavier Dury <[email protected]>:
>
>> Hi,
>>
>> I have written a CDI custom extension (with deltaspike BeanBuilder) to
>> scan all types annotated with @XmlRegistry and create one
>> @ApplicationScoped JAXBContext for my application.
>>
>> But beans referencing/injecting that JAXBContext give a NPE when created:
>>
>> java.lang.NullPointerException
>> at
>> org.apache.webbeans.proxy.AbstractProxyFactory.defineAndLoadClass(AbstractProxyFactory.java:329)
>> at
>> org.apache.webbeans.proxy.AbstractProxyFactory.createProxyClass(AbstractProxyFactory.java:240)
>> at
>> org.apache.webbeans.proxy.AbstractProxyFactory.createProxyClass(AbstractProxyFactory.java:214)
>> at
>> org.apache.webbeans.proxy.NormalScopeProxyFactory.createProxyClass(NormalScopeProxyFactory.java:269)
>> at
>> org.apache.webbeans.proxy.NormalScopeProxyFactory.createProxyClass(NormalScopeProxyFactory.java:200)
>> at
>> org.apache.webbeans.proxy.NormalScopeProxyFactory.createNormalScopeProxy(NormalScopeProxyFactory.java:149)
>> at
>> org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:767)
>> at
>> org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:668)
>> at
>> org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:103)
>> at
>> org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
>> at
>> org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
>> at
>> org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
>> at
>> org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
>> at org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:56)
>> at
>> org.apache.openejb.testing.ApplicationComposers.enrich(ApplicationComposers.java:949)
>> at
>> org.apache.openejb.testing.ApplicationComposers.deployApp(ApplicationComposers.java:729)
>> at
>> org.apache.openejb.testing.ApplicationComposers.before(ApplicationComposers.java:383)
>> at
>> org.apache.openejb.testing.ApplicationComposers.evaluate(ApplicationComposers.java:1060)
>> at
>> org.apache.openejb.junit.DeployApplication.evaluate(DeployApplication.java:40)
>>
>> The weird part is that when I create a JAXBContext through a Producer, I
>> don't have this error.
>>
>> I have written 2 test cases with ApplicationComposer (one which creates
>> the JAXBContext through @Produces and the other through an extension) but I
>> don't know where to report this error as the problem seems to come from
>> openwebbeans but I am using deltaspike and openejb to reproduce it.
>>
>> Hopefully, some people on this mailing list are members of the 3 projects
>> ;-)
>>
>> Xavier
>>
                                          

Reply via email to