How to solve ServiceConstructionException: Could not find definition for service?

ariel_ro picture ariel_ro · Jan 13, 2011 · Viewed 41.2k times · Source

I have a simple application with an web service created with Apache CXF. This application works when I run the server and the client (as Java applications). When I try to access the application /services URL which is mapped in web.xml, Tomcat gives me 404 error. When I run the project I receive:

org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://sendmessage/}SendMessage

If anyone has any hints related to this error I would be glad to hear them. (I searched google and couldn't find something relevant to my situation)

Thank you!

Answer

TastyCode picture TastyCode · Oct 29, 2013

I had same error, mine was related to namespace which were different in wsdl and webservice. So I changed them to the same.

WSDL:

<wsdl:definitions name=""
    targetNamespace="http://www.example.org/yourservice/"

Webservice class:

@WebService(targetNamespace = "http://www.example.org/yourservice/",
.........