java - Spring Boot + Apache CXF: why can't find wsdl? -
collegues, still trying "to make friends all" spring-boot, tomcat , web service implementation class:
@javax.jws.webservice( servicename = "serviceforapp", portname = "serviceendpoind", targetnamespace = "http://new.webservice.namespace", endpointinterface = "com.comp.appserv.webserviceinterface", wsdllocation = "resources/webservice.wsdl" ) public class serviceendpoindimpl implements webserviceinterface {logic};
i have application class:
package com.comp.config; import org.apache.cxf.bus; import org.apache.cxf.bus.spring.springbus; import org.apache.cxf.jaxws.endpointimpl; import org.apache.cxf.transport.servlet.cxfservlet; import org.springframework.beans.factory.annotation.autowired; import org.springframework.boot.springapplication; import org.springframework.boot.autoconfigure.springbootapplication; import org.springframework.boot.context.embedded.servletregistrationbean; import org.springframework.context.applicationcontext; import org.springframework.context.annotation.bean; import com.comp.appserv.serviceendpoindimpl; import javax.xml.ws.endpoint; @springbootapplication public class application { public static final string servlet_mapping_url_path = "/soap/*"; public static final string service_name_url_path = "/app"; @autowired private applicationcontext applicationcontext; public static void main(string[] args) { springapplication.run(application.class, args); } @bean public servletregistrationbean dispatcherservlet() { return new servletregistrationbean(new cxfservlet(), servlet_mapping_url_path); } @bean(name = bus.default_bus_id) // <bean id="cxf" class="org.apache.cxf.bus.spring.springbus"> public springbus springbus() { return new springbus(); } @bean // <jaxws:endpoint id="app" implementor="com.dlizarra.app.ws.appimpl" address="/app"> public endpoint app() { bus bus = (bus) applicationcontext.getbean(bus.default_bus_id); object implementor = new serviceendpoindimpl(); endpointimpl endpoint = new endpointimpl(bus, implementor); endpoint.publish(service_name_url_path); return endpoint; } }
and aim single jar file embedded tomcat , web service deployed on it. problem after mvn spring-boot:run
receive exception
caused by: java.io.filenotfoundexception: c:\users\maya\git\web-services\resources\webservice.wsdl (the system cannot find file specified) @ java.io.fileinputstream.open0(native method) @ java.io.fileinputstream.open(fileinputstream.java:195) @ java.io.fileinputstream.<init>(fileinputstream.java:138) @ java.io.fileinputstream.<init>(fileinputstream.java:93) @ sun.net.www.protocol.file.fileurlconnection.connect(fileurlconnection.java:90) @ sun.net.www.protocol.file.fileurlconnection.getinputstream(fileurlconnection.java:188) full stacktrace here: http://pastebin.com/ez3s5cwu
could me answers next questions:
why spring try find wsdl via link
c:\users\maya\git\web-services\resources\webservice.wsdl
, not path@javax.jws.webservice
annotation? should set path?is right approach create single jar embedded tomcat?
spring is using path annotation; relative path, current directory (where app started rom ) used build full path.
try
wsdllocation = "classpath:resources/webservice.wsdl"
to search through classpath.
as question 2, right approach start long nothing prevents it. infrastructure might veto reasons.
Comments
Post a Comment