samedi 28 février 2015

Publishing a NonSpring webservice with CXF (“No services have been found” error)

Here’s my non-spring approach to publishing a webservice:


I have a servlet that extends org.apache.cxf.transport.servlet.CXFNonSpringServlet and overrides the loadBus(ServletConfig) method (The code snippet of the loadBus method is below). This servlet is configured in the web.xml to receive all requests originating with the URL pattern /services/*



@Override
public void loadBus(ServletConfig servletConfig)
{
super.loadBus(servletConfig);
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
Endpoint ep = Endpoint.create(new myWebService());
ep.publish("/myService");
}


I should see the published services with the URL http://ift.tt/1zR9uha. But I all I see with the URL is “No services have been found” – Clearly says publishing failed.. The exception stack trace on server console is as follows:


java.lang.IllegalArgumentException: Cannot create URL for this address /myService at com.sun.xml.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:237) at com.chase.ccs.servlet.CCSCXFNonSpringServlet.loadBus(CCSCXFNonSpringServlet.java:37) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:76) at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168) at com.ibm.ws.webcontainer.servlet.ServletWrapper.load(ServletWrapper.java:1283) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:973) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:953) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1655) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1650)


can someone tell me the cause for this issue and how to overcome it?


Aucun commentaire:

Enregistrer un commentaire