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 ?

4

5 回答 5

10

您需要确保获取 Woodstox 4.2.0。或者,将系统属性 org.apache.cxf.stax.allowInsecureParser 设置为 true

于 2013-05-24T20:58:20.590 回答
2

尝试从glassfish\modules目录中删除这 2 个 jar 文件:

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

我认为它会阻止 CXF 项目中的 2 个 JAR 文件(woodstox 和 stax2)在部署后被使用。

于 2013-06-20T18:54:06.630 回答
0

我在 JDeveloper 中遇到了同样的问题,通过在类路径中添加“woodstox-core-asl-4.2.1.jar”得到了解决。

于 2014-04-21T02:59:38.977 回答
0

如果它在某处作为依赖项存在,请尝试排除它,并使用 Woodstox 4.2.0:

<artifactId>wstx-asl</artifactId>
<groupId>org.codehaus.woodstox</groupId>
于 2014-02-20T21:47:34.697 回答
0

我遇到了同样的问题,但将其部署到 web sphere,经过几个小时的研究,我找到了 woodstox 的确切版本,即下面

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

这个https://bugs.eclipse.org/bugs/show_bug.cgi?id=409070链接也有助于解决这个问题。

Java 和 .Net 客户端都可以正常工作。

于 2016-05-17T16:25:33.710 回答