Eclipse Web Service Client wizard and CXF
Asked Answered
E

5

9

I'm trying to create a Web Service Client using the Eclipse Juno SR2 wizard. The service is correctly deployed and running on a Glassfish 3.1.2 server and I can see the WSDL file or create the client using Axis. The problem arises if I try to use CXF (tried CXF 2.6.8 and 2.7.5) to create the client in a Dynamic Web project created for a GLassfish 3.1.2:

Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -client -d /Users/dude/Documents/SOA/workspace/gf/.cxftmp/src -classdir /Users/dude/Documents/SOA/workspace/gf/build/classes -p http://testservice.csiaf.unifi.it/=it.unifi.csiaf.testservice -impl -validate -exsh false -dns true -dex true -wsdlLocation http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl
wsdl2java - Apache CXF 2.6.8

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/dude/glassfish3/glassfish/modules/weld-osgi-bundle.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/apache-cxf-2.6.8/lib/slf4j-jdk14-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl
Caused by : WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory 

org.apache.cxf.tools.common.ToolException: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl
Caused by : WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory 
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:420)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Caused by: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl
Caused by : WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory 
    at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:97)
    at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.build(WSDLDefinitionBuilder.java:69)
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build(JAXWSDefinitionBuilder.java:82)
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build(JAXWSDefinitionBuilder.java:59)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:198)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
    ... 4 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:243)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:192)
    at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:78)
    ... 10 more
Caused by: java.lang.RuntimeException: Cannot create a secure XMLInputFactory
    at org.apache.cxf.staxutils.StaxUtils.createXMLInputFactory(StaxUtils.java:299)
    at org.apache.cxf.staxutils.StaxUtils.getXMLInputFactory(StaxUtils.java:254)
    at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1423)
    at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1317)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:233)
    ... 12 more

If I try to execute the wsdl2java as command line it works and .java files are created:

macpro:glassfish3 dude$ /usr/local/apache-cxf-2.6.8/bin/wsdl2java -client -d /Users/dude/Documents/SOA/workspace/gf/.cxftmp/src -classdir /Users/dude/Documents/SOA/workspace/gf/build/classes -p http://testservice.csiaf.unifi.it/=it.unifi.csiaf.testservice -impl -validate -exsh false -dns true -dex true -wsdlLocation http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -client -d /Users/dude/Documents/SOA/workspace/gf/.cxftmp/src -classdir /Users/dude/Documents/SOA/workspace/gf/build/classes -p http://testservice.csiaf.unifi.it/=it.unifi.csiaf.testservice -impl -validate -exsh false -dns true -dex true -wsdlLocation http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 http://localhost:8888/TestServiceGlassfish/TeamsService?wsdl
wsdl2java - Apache CXF 2.6.8

I suppose there's some problem in the Eclipse+CXF combo, since the command line works, but I've no clue about how to solve it. Any idea ?

Embroidery answered 24/5, 2013 at 18:34 Comment(0)
O
10

You need to make sure Woodstox 4.2.0 is being picked up. Alternatively, set the system property org.apache.cxf.stax.allowInsecureParser to true

Oulu answered 24/5, 2013 at 20:58 Comment(3)
I think you are right: the problem is that even adding the Woodstox JARs to the project build path (even adding them in the CXF directories so they are picked by Eclipse when adding the runtime) is not enough: the wizard seems to ignore them. So far I've resolved to go back to older CXF where Woodstox was not required, and I've filed an Eclipse bug to ask them to check how the wizard works.Embroidery
Which version doesn't require Woodstox?Knuth
If you upgrade to CXF 3.0.0 or later, you shouldn't add woodstock (woodstox-core-asl and stax2-api) dependencies. If you do you will get the famous exceptionManuel
S
2

Try removing these 2 jar files from the glassfish\modules directory:

  • woodstox-core-asl.jar
  • stax2-api.jar

I think it will prevent the 2 JAR files (woodstox and stax2) from the CXF project from being used after deployment.

Solidstate answered 20/6, 2013 at 18:54 Comment(0)
B
0

Try excluding this if it exists as a dependency somewhere, and use Woodstox 4.2.0:

<artifactId>wstx-asl</artifactId>
<groupId>org.codehaus.woodstox</groupId>
Bestride answered 20/2, 2014 at 21:47 Comment(0)
A
0

I faced the same issue in JDeveloper and that got resolved by adding "woodstox-core-asl-4.2.1.jar" to the classpath.

Andres answered 21/4, 2014 at 2:59 Comment(0)
T
0

i was facing the same issue but deploying it to web sphere, and after a research of few hours figured out the exact version for woodstox, i.e. below

<dependency>
    <groupId>org.codehaus.woodstox</groupId>
    <artifactId>woodstox-core-asl</artifactId>
    <version>4.2.0</version>
</dependency>

This https://bugs.eclipse.org/bugs/show_bug.cgi?id=409070 link also helped to figured it out.

Both Java and .Net clients working fine.

Tuchun answered 17/5, 2016 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.