简体   繁体   中英

javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service

I need desperate help to figure out the reason for the failure in creating the service.

My application is developed using Eclipse tool and it runs well there. It uses cxf-3.1.7 library collection. A console program that initializes the process to create the service to the API. Everything looks good and fine.

I am trying to deploy the code in another machine. I installed the necessary jre and other files. I created a batch file with all the necessary path and classpath settings. I need to run the batch file on a daily base, so that it pulls the data regularly. But, when I run the batch file, it fails to create the service with the above error message.

Can someone suggest me the reason if I am going wrong somewhere or any solution to get the service created. This is the batch file I have:

set path=C:\Program Files\Java\jdk1.8.0_91\bin 
set classpath=cxf-core-3.1.7.jar;cxf-rt-frontend-simple-3.1.7.ja‌​r;sqljdbc42.jar;cxf-‌​rt-frontend-jaxws-3.‌​1.7.jar;wsdl4j-1.6.3‌​.jar;cxf-rt-wsdl-3.1‌​.7.jar;xmlschema-cor‌​e-2.2.1.jar;lib*.jar‌​;. 
java com.strongmail.services.v2.MailingService_MailingServicePort‌​_Client 
pause

Thanks in advance.

I've created java classes from wsdl with org.apache.cxf.tools.wsdlto.WSDLToJava . While creating an instance of the service, I had exact same exception at runtime:

org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service

Previous code:

URL wsdlURL = new URL("http://example.com/my_service.asmx");
MyWS mailWS = new MyWS(wsdlURL); // Exception is thrown here

Solution was weird. I've just added ?wsdl next to service address:

URL wsdlURL = new URL("http://example.com/my_service.asmx?wsdl");
MyWS mailWS = new MyWS(wsdlURL);

This is more than likely a PKIX Certificate error. Take a look at some other articles on here for assistance. Resolving javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed Error?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM