users@glassfish.java.net

NullPointerException com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:205)

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Tue, 06 Sep 2011 13:59:50 -0400

While migrating my webapp from Glassfish 3.1 to Glassfish 3.1.1 I am
running into NPE shown in stack trace below:

Caused by: java.lang.NullPointerException
         at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:205)
         at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:186)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
         at
com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.<init>(ArrayElementProperty.java:112)
         at
com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.<init>(ArrayElementNodeProperty.java:62)
         at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at
com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
         at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
         at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:168)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
         at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:168)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:326)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
         at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157)
         at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
         at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:236)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:187)
         at javax.xml.bind.ContextFinder.find(ContextFinder.java:333)
         at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
         at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)

Searching suggests
<http://fusesource.com/forums/thread.jspa?threadID=3010> that it has
something to do with version collision in JAXB jars bundled by Glassfisg
3.1.1 and those in in my war file's WEB-INF/lib directory.

My war currently uses the following versioned jars as dependencies
bundled within my webapp's WEB-INF/lib directory and my Glassfish 3.1.1
runs under JDK 6.

javax.xml.bind:jaxb-api:jar:2.2.1:compile
com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile

Can any one tell me what is causing this problem and what do I need to
do to fix this problem?

-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com