Reputation: 31
cxf version used 3.2.2
All cxf version lib were used in WEB-INF\lib folder
This is the exception thrown
13-Mar-2018 21:38:20.806 WARNING [localhost-startStop-1]
org.apache.cxf.ws.discovery.internal.WSDiscoveryServiceImpl.startup
Could not start WS-Discovery Service.
javax.xml.ws.WebServiceException: java.lang.NullPointerException
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
at
org.apache.cxf.ws.discovery.internal.WSDiscoveryServiceImpl.
startup(WSDiscoveryServiceImpl.java:259)
at
org.apache.cxf.ws.discovery.internal.WSDiscoveryServiceImpl.
serverStarted(WSDiscoveryServiceImpl.java:154)
at org.apache.cxf.ws.discovery.listeners.WSDiscoveryServerListener.
startServer(WSDiscoveryServerListener.java:73)
at org.apache.cxf.bus.managers.ServerLifeCycleManagerImpl.
startServer(ServerLifeCycleManagerImpl.java:61)
at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:137)
at org.apache.cxf.frontend.ServerFactoryBean.create
(ServerFactoryBean.java:224)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create
(JaxWsServerFactoryBean.java:211)
at org.apache.cxf.jaxws.spring.NamespaceHandler$
SpringServerFactoryBean.create(NamespaceHandler.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
--------------------------apache cxf 3.2.2 version samples code
@WebService(name="HelloWorld")
@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL)
public interface HelloWorld {
String sayHi(String text);
String sayHiToUser(User user);
@XmlJavaTypeAdapter(IntegerUserMapAdapter.class)
Map<Integer, User> getUsers();
}
------------------i am adding web.xml and cxf-servlet.xml
--------------------------apache-cxf-services.xml http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> -------------------------------------------apache-cxf-services.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:soap="http://cxf.apache.org/bindings/soap" xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:server id="jaxwsService"
serviceClass="demo.hw.server.HelloWorld" address="/hello_world">
<jaxws:serviceBean>
<bean class="demo.hw.server.HelloWorldImpl"/>
</jaxws:serviceBean>
</jaxws:server>
</beans>
Upvotes: 0
Views: 1105
Reputation: 1397
Unfortunately the real cause is missing in the stacktrace you posted. I've just added a goal to run Tomcat 8 directly from Maven for this https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/java_first_jaxws sample. You can run it with mvn cargo:run
to see that it's working.
I wonder why you have added ws-discovery, it's not part of the sample.
Upvotes: 0