GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes JAXB/reflection exceptions (unable to inject) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB/reflection exceptions (unable to inject)" Watch "JAXB/reflection exceptions (unable to inject)" New topic
Author

JAXB/reflection exceptions (unable to inject)

James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
I have an application which has recently been producing exception traces in my log file regarding JAXB binding. I can't catch these exceptions with a catch block around the line where the exception is happening, perhaps the log messages are coming from the web server itself (SJWS7) which is just printing the exceptions and swallowing them. The exceptions I see look like the below, and they are happening when I hit a line of code in which I am getting a new instance of a JAXBContext.

Any clues as to why this is happening would be really appreciated, it doesn't make sense to me. Thanks in advance!


--James



Unable to inject com/sun/scn/cs/domain/data/DomainInfo$JaxbAccessorM_getDomainName_setDomainName_java_lang_String
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:125)
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:48)
at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:51)
at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:77)
at com.sun.xml.bind.v2.runtime.reflect.Accessor$GetterSetterReflection.optimize(Accessor.java:308)
at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.<init>(SingleElementLeafProperty.java:45)
at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:88)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:135)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:404)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:246)
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.GeneratedMethodAccessor40.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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 javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
at com.sun.scn.cs.accountmgmt.dao.DomainInfoDAO.<init>(DomainInfoDAO.java:53)
at com.sun.scn.cs.accountmgmt.rest.GetDomain.<init>(GetDomain.java:37)
at com.sun.scn.cs.accountmgmt.DomainMgmtService.invoke(DomainMgmtService.java:104)
at com.sun.scn.cs.accountmgmt.DomainMgmtService.invoke(DomainMgmtService.java:34)
at com.sun.xml.ws.server.provider.ProviderPeptTie._invoke(ProviderPeptTie.java:65)
at com.sun.xml.ws.protocol.xml.server.XMLMessageDispatcher.invokeEndpoint(XMLMessageDispatcher.java:162)
at com.sun.xml.ws.protocol.xml.server.XMLMessageDispatcher.access$400(XMLMessageDispatcher.java:67)
at com.sun.xml.ws.protocol.xml.server.XMLMessageDispatcher$XmlInvoker.invoke(XMLMessageDispatcher.java:470)
at com.sun.xml.ws.protocol.xml.server.XMLMessageDispatcher.receive(XMLMessageDispatcher.java:110)
at com.sun.xml.ws.server.Tie.handle(Tie.java:90)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.handle(WSServletDelegate.java:335)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:193)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doGet(WSServlet.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:796)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:917)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:391)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:272)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:241)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:182)
at org.apache.catalina.core.StandardPipeline.in
[29/May/2007:12:04:28] fine (26125) ja-z1: for host 172.20.28.163 trying to GET /accountmgmt/domain, service-j2ee reports: Unable to inject com/sun/scn/cs/domain/data/DomainInfo$JaxbAccessorM_getDomainName_setDomainName_java_lang_String
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:125)
at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:48)
at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:51)
at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:77)
at com.sun.xml.bind.v2.runtime.reflect.Accessor$GetterSetterReflection.optimize(Accessor.java:308)
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.<init>(TransducedAccessor.java:193)
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccessor.java:135)
at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.<init>(SingleElementLeafProperty.java:47)
at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:88)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:135)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:404)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:246)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
It turns out that my problem was having a wrong prefix name in the package-info.java for my data package. Once I used the correct prefix name and rebuilt the JAR then my troubles went away.

The line in question in the package-info.java where the error was located:

@javax.xml.bind.annotation.XmlNs(prefix =
James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
It seems that the incorrect prefix was not the problem after all -- any suggestions/ideas are very welcome!

--James
 
GeeCON Prague 2014
 
subject: JAXB/reflection exceptions (unable to inject)