0 Replies Latest reply on May 10, 2017 1:03 PM by yada_r3tek

    Adobe AEM 6.2, customer component to call external webservice throws NullPointerException jaxb.Utils.getFieldXJTA(Utils.java:269)

    yada_r3tek Level 1

      Below is the question asked by my colleague on stack exchange but, I thought I would post here too. We are not able to call an external web service. 

       

      I am facing exact same issue that has been asked in this question: here.

      I am writing a custom component for AEM 6.2 which will call an external web service and get some data. I followed the tutorial they had on here. I have unit tested my code and works fine, but when I deploy the component inside AEM, it gives me NullPointerException at this line of my code(getPort!):

      MyService service = new MyService_Service().getMyServicePort();

      I used maven, cxf-codegen-plugin, to generate client code.

      The question that was asked is marked as answered but I couldn't figure out what the answer was really! Can anyone explain [possibly with sample config/code] what do I exactly need do to?

      Here is my stack trace:

      java.lang.NullPointerException at org.apache.cxf.jaxb.Utils.getFieldXJTA(Utils.java:269) at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:374 ) at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:346) at org.apache.cxf.jaxb.JAXBContextInitializer.begin(JAXBContextInitializer.java:183) at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:97) at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:336) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(Abstract ServiceFactoryBean.java:86) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(Reflecti onServiceFactoryBean.java:446) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(Reflec tionServiceFactoryBean.java:548) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFacto ryBean.java:265) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java: 215) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBased EndpointFactory.java:102) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157) at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142) at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:478) at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.ja va:558) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:345) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:336) at javax.xml.ws.Service.getPort(Service.java:99) [jboss-jaxws-api_2.2_spec-2.0.2.Final-redhat-1.jar:2.0.2.Final-redhat-1]