I'm trying to use a service in my spring boot application. This exact client works fine in netbeans and an older project using spring 3 MVC but when I try to call the same method I get javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory
.
I searched a lot and tried different answer but no luck! these are some of question on stackoverflow that I tried:
CXF web service client: "Cannot create a secure XMLInputFactory"
java.lang.RuntimeException: Cannot create a secure XMLInputFactory when deploying on Glassfish
Cannot create a secure XMLInputFactory
Cannot create a secure XMLInputFactory when calling Apache CXF Client from Plain Java
Although passing a VM Option for allowing less secure parsers wasn't a solution for me I tried that. When I added the -Dorg.apache.cxf.stax.allowInsecureParser=1
the first line of code does not throw the specified exception but on second line when I try to get the port a java.lang.NoSuchFieldError: QUALIFIED
will be thrown!
Code for calling service:
MessageRelayService messageRelayService = new MessageRelayService();
MessageRelay msgService = messageRelayService.getMessageRelayPort();
CountResult countResult = msgService.getReceivedMessageCount(USERNAME, PASSWORD);
My pom(some parts were omitted for brevity):
<properties>
...
<java.version>1.8</java.version>
<cxf.version>3.0.0</cxf.version>
<swagger.version>2.6.0</swagger.version>
<purchase.version>1.2.4</purchase.version>
<spring-cloud.version>Camden.SR2</spring-cloud.version>
...
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
.
.
.
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
.
.
.
</dependencies>
...
Any help would be greatly appreciated.