Search code examples
javajbosscxfsoap-client

NullPointerException jaxb.Utils.getFieldXJTA(Utils.java:269)


Error:

INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (http-0.0.0.0-8080-8) Creating Service {http://schemas.microsoft.com/sharepoint/soap/}CopySoapService from class com.microsoft.schemas.sharepoint.soap.CopySoap
java.lang.NullPointerException
at org.apache.cxf.jaxb.Utils.getFieldXJTA(Utils.java:269)
at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:375)
at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:347)
at org.apache.cxf.jaxb.JAXBContextInitializer.begin(JAXBContextInitializer.java:184)
at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:97)
at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74)

Info: Jboss running Adobe LiveCycle ES4 SP1 on Windows Server 2008

Googling resulted in nothing helpful to resolve this error. The code works perfectly within in the IDE. This error occurs when deployed as a Custom Component withing LiveCycle that is running on Jboss.

Related Q/A that got me to this point:

Java JBoss 401 Error on SharePoint 2010 Web Service


Solution

  • I had the same problem, working with custom ClassLoader and the reason appeared to be the lack of a "Package" defined for classes. I corrected the ClassLoader implementation defining packages for loaded classes and all started to work fine for me.

    In a few words, the NullPointerException was generated by the call to f.getDeclaringClass().getPackage().getAnnotation(XmlJavaTypeAdapters.class);. In my case f.getDeclaringClass().getPackage() returned null.

    I don't know if this will help someone else, but I got it working in my very special case and I decided to share this.

    I forgot to post a source reference:

    http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-rt-databinding-jaxb/3.1.1/org/apache/cxf/jaxb/Utils.java#269