2.2.8-SNAPSHOT版本的cxf-codegen-plugin有什么特别之处?

时间:2013-01-07 15:50:00

标签: java spring jax-ws cxf

我继承了一个基于CXF的项目,具有以下(相关)原始依赖项(在pom.xml中):

<dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>2.2.7</version>
</dependency>
<dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>2.2.7</version>
</dependency>
<dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-security</artifactId>
        <version>2.2.7</version>
</dependency>

<plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>2.2.8-SNAPSHOT</version>

通过“原创”我的意思是这是我收到的用于构建精细多年前的源代码快照,这些年来一直处于休眠状态,现在,对代码的一些修改是需要时,它不再按照构建。

尝试按“原样”构建它的主要问题是2.2.8-SNAPSHOT cxf-codegen-plugin版本的<plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>2.2.8</version> 无处可寻找 ... Maven不能找到它并使构建失败。

所以,我用上面的内容替换了(注意,唯一的区别是2.2.8 vs. 2.2.8-SNAPSHOT)

Password.set_value(String value)

现在,构建成功超过此点,但未找到2个符号失败:

  1. org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_secext_1_0 - 来自包SQLService.setENDPOINT(String sei)
  2. javax.xml.ws.Service来自基于Password
  3. 的自有包

    SQLServicePassword.set_value(String value)的两个源文件都是由Apache CXF 2.2.8即时生成的,由该项目的原作者设计。

    所以,我很快检查了这些文件的新生成版本并发现:

    1. Password.setValue(String value)似乎已被SQLService.setENDPOINT(String sei)替换。
    2. SQLService(URL wsdlLocation, QName serviceName)已完全删除,而是要求在构造函数中传递:WARNING: Interceptor for {http://rservice.rorg.net/sql}SQLService#{http://rservice.rorg.net/sql}Get has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) at $Proxy38.get(Unknown Source) ... Caused by: java.net.ConnectException: ConnectException invoking http://localhost:8080/rservice/services/SQLServiceSoap: Connection refused at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:522) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:2058) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2043) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 14 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:413) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:274) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:261) at java.net.Socket.connect(Socket.java:556) at sun.net.NetworkClient.doConnect(NetworkClient.java:175) at sun.net.www.http.HttpClient.openServer(HttpClient.java:403) at sun.net.www.http.HttpClient.openServer(HttpClient.java:521) at sun.net.www.http.HttpClient.<init>(HttpClient.java:246) at sun.net.www.http.HttpClient.New(HttpClient.java:320) at sun.net.www.http.HttpClient.New(HttpClient.java:337) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:948) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:873) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1040) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1955) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1907) at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42) at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1974) ... 17 more 04-Jan-2013 12:07:17 ERROR [SQLModule] Error running SQL module: Could not send Message. javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) at $Proxy38.get(Unknown Source) at net.rorg.rservice.client.base.sql.SQLClientBase.get(SQLClientBase.java:306) at net.rorg.rservice.client.module.sql.SQLModule.getBatch(SQLModule.java:149) at net.rorg.rservice.client.module.sql.SQLModule.getAndProcessSQL(SQLModule.java:110) at net.rorg.rservice.client.module.sql.SQLModule.run(SQLModule.java:280) at net.rorg.rservice.client.RClient.exec(RClient.java:398) at net.rorg.rservice.client.RClient.run(RClient.java:173) at net.rorg.rservice.client.RClient.main(RClient.java:166) Caused by: java.net.ConnectException: ConnectException invoking http://localhost:8080/rservice/services/SQLServiceSoap: Connection refused at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:522) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:2058) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2043) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) ... 8 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:413) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:274) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:261) at java.net.Socket.connect(Socket.java:556) at sun.net.NetworkClient.doConnect(NetworkClient.java:175) at sun.net.www.http.HttpClient.openServer(HttpClient.java:403) at sun.net.www.http.HttpClient.openServer(HttpClient.java:521) at sun.net.www.http.HttpClient.<init>(HttpClient.java:246) at sun.net.www.http.HttpClient.New(HttpClient.java:320) at sun.net.www.http.HttpClient.New(HttpClient.java:337) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:948) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:873) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1040) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1955) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1907) at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42) at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1974) ... 17 more
    3. 所以我修改了调用这些方法的源代码以适应这两个看似微小的变化,现在项目已成功构建!

      但是...... 它在运行时失败,但有以下例外:

      http://localhost:8080

      注意:即使我在WSDL中对实际(www)服务器URL进行硬编码(即用https://test.rserver.com替换http://localhost:8080),我也会得到 ConnectException < / em>错误显示http://localhost:8080作为目标。显然,不执行某些CXF替换或解决方案。这可能是问题所在的线索吗? CXF的哪个组件负责从at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:484) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) 到真实URL的神奇转换?

      是否正确堆栈跟踪提示(即 JaxWsClientProxy frontend.ClientProxy 或......)?

      cxf-codegen-plugin

      如果是这样,为什么会发生这种情况,我该如何解决这个问题?

      现在......如果我是CXF和/或JAX-WS专家,我可能已经找到了堆栈跟踪中误导性“连接拒绝”提示的根本原因。

      但是在这一点上我几乎迷失了,因为我已经确定SEI在那里,验证用户名/密码是正确的:较旧的二进制文件(带有依赖项的JAR)对这个服务运行得很好。

      因此,我正在寻找一位专家的线索或见解,他可能已经看到过这种类型的“连接拒绝”堆栈跟踪,并且知道它可以由触发而不是< / strong> typical reasons。例如,{{1}} 2.2.8-SNAPSHOT被2.2.8替换后引入的某种类型的不匹配?

      有关如何解决此问题的其他提示?

1 个答案:

答案 0 :(得分:2)

我认为您对SQLService的更改可能是问题

  

SQLService.setENDPOINT(String sei)已完全删除,并且   而是要求在构造函数中传递sei:   SQLService(URL wsdlLocation,QName serviceName)

您是否在构造函数调用中添加了新URL?之前的sei是什么?如果您输入了URL,则可能是其连接失败。您应该能够使用no-arg构造函数。

如果您想在运行时设置URL(我猜这是setENDPOINT调用正在进行的操作),您需要操纵BindingProvider。请参阅此主题http://cxf.547215.n5.nabble.com/How-to-change-the-service-URL-at-runtime-td3242927.html