users@jaxb.java.net

JAXBContext.newInstance Issue

From: Lichtenwalter, Ryan <ryan.lichtenwalter_at_lmco.com>
Date: Tue, 07 Nov 2006 10:39:14 -0600

This is very strange because I honestly do not know what changed to
break things. Before, my JAXB web service worked fine; now,
JAXBContext.newInstance( packageName, this.getClass().getClassLoader() )
fails. My stack trace is below. The main error thrown is a generic
NullPointerException

Some things I checked myself:

Is the version of JAXB on the server and the version compiling the
schema the same? Yes.
Are there any potential collisions on class names or package names? No.
Does loading the classes with JAXBContext.newInstance( { class1.class,
class2.class, etc.class } ) work? No.

Additionally, I have researched this problem and found sites such as

http://forums.java.net/jive/thread.jspa?threadID=18479
http://forums.java.net/jive/thread.jspa?messageID=165946

but I still have no idea what the root cause of the problem is. Also,
the only suggestion, adding a non-default class loader, does not work
for me. Are there any ideas offhand what I could be doing incorrectly?
Thank you.

Ryan


java.lang.NullPointerException
        at
com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.calcXmlName(PropertyInfo
Impl.java:287)
        at
com.sun.xml.bind.v2.model.impl.PropertyInfoImpl.calcXmlName(PropertyInfo
Impl.java:260)
        at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl.getTypes(ElementP
ropertyInfoImpl.java:100)
        at
com.sun.xml.bind.v2.model.impl.RuntimeElementPropertyInfoImpl.getTypes(R
untimeElementPropertyInfoImpl.java:50)
        at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size(ElementPro
pertyInfoImpl.java:42)
        at java.util.AbstractList$Itr.hasNext(AbstractList.java:416)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.ja
va:139)
        at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeM
odelBuilder.java:49)
        at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeM
odelBuilder.java:41)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.jav
a:189)
        at
com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.
java:63)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.jav
a:232)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.jav
a:201)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:3
52)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:3
50)
        at java.security.AccessController.doPrivileged(Native Method)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextIm
pl.java:349)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:
215)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124
)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
        at
com.lmco.eagan.safeseas.midasinterface.TrackRequestService.getTracksMIDA
S(TrackRequestService.java:53)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.sun.xml.ws.server.PeptTie._invoke(PeptTie.java:58)
        at
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.invokeEndpoint
(SOAPMessageDispatcher.java:278)
        at
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.in
voke(SOAPMessageDispatcher.java:586)
        at
com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMe
ssageDispatcher.java:145)
        at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
        at
com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:191)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at
org.apache.catalina.core.ApplicationFilterChain.servletService(Applicati
onFilterChain.java:397)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:278)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
36)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:240)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:179)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
:566)
        at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:182)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
:566)
        at
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipelin
e.java:120)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:137)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java
:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
36)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
        at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(Pro
cessorTask.java:667)
        at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked
(ProcessorTask.java:574)
        at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(Processor
Task.java:844)
        at
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(R
eadTask.java:287)
        at
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:2
12)
        at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
        at
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.j
ava:75)