Could code that uses Apache Commons VFS be plugged in at just the right spot to resolve "jar:file:..."?
Gary -----Original Message----- From: Glen Mazza [mailto:[email protected]] Sent: Friday, October 28, 2011 10:41 AM To: [email protected] Subject: Re: NullPointerException with WSDL loading (cxf 2.4.2 and 2.4.3) A google of <wsdlLocation = "jar:file> is suggesting it will be (very?) problematic getting that to work. I would still recommend separation of the problem into two parts, i.e., using that interim step I mentioned below. Let's make sure the web service works with the WSDL hardcoded (literally: "/home/terelleh/.../mywsdl.wsdl" or "c:\blah\blah\mywsdl.wsdl") and outside the JAR, then see what (if anything) can be done about getting it to work with the WSDL inside the JAR. Glen On 10/28/2011 10:18 AM, Hugo Terelle wrote: > Hi Glen, > > Thank you for your answer. > > Here is the code I have > > @javax.jws.WebService( > serviceName = "DeviceService", > portName = "DevicePort", > targetNamespace = "http://www.onvif.org/ver10/device/wsdl", > wsdlLocation = > "jar:file:/home/terelle/onvif/onvif-srv-0.1-jar-with-dependencies.jar!/META-INF/wsdl/devicemgmt.wsdl", > endpointInterface = "org.onvif.ver10.device.wsdl.DevicePortType") > public class DevicePortTypeImpl implements DevicePortType { ... > > The wsdl can be found at > http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl but it > needs some modification (service binding, etc) > > Nothing more is added to the code ... > > Even if I try with no wsdlLocation, I get another error ... > And I'm still wondering why it's running under eclipse but not outside > ... > > > For Jetty, we use the embedded version ... > > > Hugo > > > > > On 10/28/2011 03:07 PM, Glen Mazza wrote: >> I'm not sure what the problem is (telling us what type of values >> you're placing in for wsdlLocation may help -- IIRC it needs to be an >> absolute path, and I don't believe you can use a classpath: prefix >> either), Are you using embedded Jetty or standalone Jetty -- for the >> latter, you can just create a WAR >> (http://www.jroller.com/gmazza/entry/web_service_tutorial) which >> should be simpler and more robust anyway. >> >> If you can store the WSDL outside of the JAR, and make a hardcoded >> reference to it from the Service class within the JAR, that might >> work, at least as an interim step before trying with the WSDL in the >> JAR. >> >> HTH, >> Glen >> >> On 10/28/2011 07:20 AM, Hugo Terelle wrote: >>> Hi, >>> >>> With cxf 2.4.2 and 2.4.3, I catch the following exception : >>> >>> 2011-10-28 13:06:34,830 INFO [ReflectionServiceFactoryBean] >>> Creating Service >>> {http://www.onvif.org/ver10/device/wsdl}DeviceService from WSDL: >>> jar:file:/home/terelle/onvif/onvif-srv-0.1-jar-with-dependencies.jar >>> !/META-INF/wsdl/devicemgmt.wsdl >>> >>> Exception in thread "main" javax.xml.ws.WebServiceException: >>> java.lang.NullPointerException >>> at >>> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:350) >>> at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239) >>> at eu.acic.onvif.NVTServer.<init>(NVTServer.java:81) >>> at eu.acic.onvif.NVTServer.main(NVTServer.java:127) >>> Caused by: java.lang.NullPointerException >>> at >>> org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92) >>> at >>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:369) >>> at >>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:505) >>> at >>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241) >>> at >>> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202) >>> at >>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101) >>> at >>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:157) >>> at >>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:202) >>> at >>> org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:433) >>> at >>> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:322) >>> >>> >>> >>> I'm catching this exception when I do the following instruction: >>> >>> DevicePortTypeImpl deviceImplementor = new DevicePortTypeImpl(); >>> String serviceAddress = "http://0.0.0.0:8080/onvif/device_service"; >>> EndpointImpl epDevice = (EndpointImpl) >>> Endpoint.create(serviceAddress, deviceImplementor); >>> epDevice.publish(serviceAddress); >>> >>> OR with >>> >>> DevicePortTypeImpl deviceImplementor = new DevicePortTypeImpl(); >>> String serviceAddress = "http://0.0.0.0:8080/onvif/device_service"; >>> EndpointImpl epDevice = (EndpointImpl) >>> Endpoint.publish(serviceAddress, deviceImplementor); >>> >>> >>> The Java code was generated from a WSDL with cxf-codegen-plugin >>> (wsdl2java) and I just changed the wsdlLocation annotation in the >>> "DevicePortTypeImpl" class. >>> >>> >>> My big problem is that it was always working under Eclipse, and now >>> that I have to deploy a standalone JAR (built with mvn >>> assembly:single instruction), it doesn't work... >>> Even worst, I can put what I want as path in the wsdlLocation >>> annotation, it's always working under Eclipse... And I can't deploy >>> Eclipse on my customer system :) >>> >>> For information, I use Jetty, nothing with JBoss, Glassfish and so >>> on. It's a standalone application (the server was also generated >>> with wsdl2java). >>> >>> Help!!! >>> >>> Regards, >>> Hugo Terelle >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >> > -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza/ Twitter - glenmazza
