Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何强制/配置Axis2使用TLS 1.1或更高版本_Java_Java 7_Axis2_Tls1.2 - Fatal编程技术网

Java 如何强制/配置Axis2使用TLS 1.1或更高版本

Java 如何强制/配置Axis2使用TLS 1.1或更高版本,java,java-7,axis2,tls1.2,Java,Java 7,Axis2,Tls1.2,我有一个应用程序使用Axis2生成的源代码(WSDL2java客户端代码,XMLbeans,使用Axis2-1.6.4)连接到服务。它一直工作得很好 我正在连接的服务将很快停止接受传入的TLSv1连接,因此我需要了解如何使用TLSv1.1或TLSv1.2进行连接。我的客户机代码运行的是Java1.7,通过创建一个简单的测试客户机并像这样运行,我已经确认了必要的支持 java -Dhttps.protocols=TLSv1.1,TLSv1.2 TestConnect 在最终确定了在这种情况下哪个

我有一个应用程序使用Axis2生成的源代码(WSDL2java客户端代码,XMLbeans,使用Axis2-1.6.4)连接到服务。它一直工作得很好

我正在连接的服务将很快停止接受传入的TLSv1连接,因此我需要了解如何使用TLSv1.1或TLSv1.2进行连接。我的客户机代码运行的是Java1.7,通过创建一个简单的测试客户机并像这样运行,我已经确认了必要的支持

java -Dhttps.protocols=TLSv1.1,TLSv1.2 TestConnect
在最终确定了在这种情况下哪个是客户端之后,它似乎仍然丝毫没有影响握手。这意味着,套接字在尝试连接时被重置(与我的TestConnect应用程序不同,它连接得很好)。另外,当我还设置“-Djavax.net.debug=ssl:handshake:verbose”时,我看到v1.0仍在握手中使用:

%% No cached client session
*** ClientHello, TLSv1
http-bio-8080-exec-9, WRITE: TLSv1 Handshake, length = 149
Finalizer, called close()
Finalizer, called closeInternal(true)
Finalizer, called close()
Finalizer, called closeInternal(true)
http-bio-8080-exec-9, handling exception: java.net.SocketException: Connection reset
http-bio-8080-exec-9
, SEND TLSv1 ALERT:  
fatal, 
description = unexpected_message
http-bio-8080-exec-9, WRITE: TLSv1 Alert, length = 2
http-bio-8080-exec-9, Exception sending alert: java.net.SocketException: Broken pipe
我最后还注意到,基于文档,设置https.protocol只会影响通过使用HttpsURLConnection类或通过URL.openStream()操作进行的连接。这让我怀疑axis2正在做其他事情,或者希望有一种不同的方式来实现相同的支持

有人能给我指出正确的方向吗?或者证实或反驳我的想法

以下是完整的堆栈跟踪:

2016-02-06 13:25:06942[http-bio-8080-exec-9]INFO httpclient.HttpMethodDirector-处理请求时捕获到I/O异常(org.apache.axis2.AxisFault):连接已关闭:javax.net.ssl.SSLException:java.net.SocketException:连接重置
2016-02-06 13:25:06948[http-bio-8080-exec-9]调试httpclient.HttpMethodDirector-连接已关闭:javax.net.ssl.SSLException:java.net.SocketException:连接重置
消息:连接已关闭:javax.net.ssl.SSLException:java.net.SocketException:Connection reset
直线法
->>430 | org.apache.axis2.AxisFault中的makeFault
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|78 |在org.apache.axis2.transport.http.SOAPMessageFormatter中写入
|84 |书面请求。在org.apache.axis2.transport.http.AxisRequestEntity中
|499 | org.apache.commons.httpclient.methods.EntityEnclosingMethod中的writeRequestBody
|2114 |书面请求。在org.apache.commons.httpclient.HttpMethodBase中
|1096 |在“”中执行
|398 |执行重试。在org.apache.commons.httpclient.HttpMethodDirector中
|171 |在“”中执行方法
|397 |执行方法。在org.apache.commons.httpclient.httpclient中
|621 | org.apache.axis2.transport.http.AbstractHTTPSender中的executeMethod
|193 | sendViaPost。在org.apache.axis2.transport.http.HTTPSender中
|75 |输入“
|396 |在org.apache.axis2.transport.http.commons HttpTransportSender中编写带有Commons的消息
|223 |在“”中调用
|443 |发送。在org.apache.axis2.engine.AxisEngine中
|406 |发送到org.apache.axis2.description.OutInAxisOperationClient
|229执行委员会。在“
|165 |在org.apache.axis2.client.OperationClient中执行
|1960 |登录。在com.zuora.api.ZuoraServiceStub中
|com.zuora.zortal.util.ZApi$$EPbyIuau中的
|     48 |  . . . . . . . .  在com.zuora.zortal.repository.ZuoraRepository中
|40 |登录saaseiportal.unauthorized.LoginController
|195 | doFilter。在grails.plugin.cache.web.filter.PageFragmentCachingFilter中
|63 | grails.plugin.cache.web.filter.AbstractFilter中的doFilter
|1145 |运行工人。在java.util.concurrent.ThreadPoolExecutor中
|615 |在java.util.concurrent.ThreadPoolExecutor$Worker中运行
^745 |运行。在java.lang.Thread中
由WstxIOException引起:连接已关闭:javax.net.ssl.ssLexException:java.net.SocketException:连接重置
->>261 |在com.ctc.wstx.sw.BaseStreamWriter中刷新
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|50 |刷新org.apache.axiom.util.stax.wrapper.xmlStreamWriterRapper
|224 |关闭。在org.apache.axiom.om.impl.MTOMXMLStreamWriter中
|320 | ajc$interMethod$org_apache_axiom_om_impl_common_axiom容器支持$org_apache_axiom_om_impl_common_axiom容器$serialized并在org.apache.axiom.om.impl.common.axiom容器支持中消费
|1 |序列化和消费。在org.apache.axiom.om.impl.llom.OMElementImpl中
|74 |在org.apache.axis2.transport.http.SOAPMessageFormatter中写入
|84 |书面请求。在org.apache.axis2.transport.http.AxisRequestEntity中
|499 | org.apache.commons.httpclient.methods.EntityEnclosingMethod中的writeRequestBody
|2114 |书面请求。在org.apache.commons.httpclient.HttpMethodBase中
|1096 |在“”中执行
|398 |执行重试。在org.apache.commons.httpclient.HttpMethodDirector中
|171 |在“”中执行方法
|397 |执行方法。在org.apache.commons.httpclient.httpclient中
|621 | org.apache.axis2.transport.http.AbstractHTTPSender中的executeMethod
|193 | sendViaPost。在org.apache.axis2.transport.http.HTTPSender中
|75 |输入“
|396 |在org.apache.axis2.transport.http.commons HttpTransportSender中编写带有Commons的消息
|223 |在“”中调用
|443 |发送。在org.apache.axis2.engine.AxisEngine中
|406 |发送到org.apache.axis2.description.OutInAxisOperationClient
|229执行委员会。在“
|165 |在org.apache.axis2.client.OperationClient中执行
|
2016-02-06 13:25:06,942 [http-bio-8080-exec-9] INFO  httpclient.HttpMethodDirector  - I/O exception (org.apache.axis2.AxisFault) caught when processing request: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
2016-02-06 13:25:06,948 [http-bio-8080-exec-9] DEBUG httpclient.HttpMethodDirector  - Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
Message: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
    Line | Method
->>  430 | makeFault               in org.apache.axis2.AxisFault
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     78 | writeTo                 in org.apache.axis2.transport.http.SOAPMessageFormatter
|     84 | writeRequest . . . . .  in org.apache.axis2.transport.http.AxisRequestEntity
|    499 | writeRequestBody        in org.apache.commons.httpclient.methods.EntityEnclosingMethod
|   2114 | writeRequest . . . . .  in org.apache.commons.httpclient.HttpMethodBase
|   1096 | execute                 in     ''
|    398 | executeWithRetry . . .  in org.apache.commons.httpclient.HttpMethodDirector
|    171 | executeMethod           in     ''
|    397 | executeMethod . . . . . in org.apache.commons.httpclient.HttpClient
|    621 | executeMethod           in org.apache.axis2.transport.http.AbstractHTTPSender
|    193 | sendViaPost . . . . . . in org.apache.axis2.transport.http.HTTPSender
|     75 | send                    in     ''
|    396 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender
|    223 | invoke                  in     ''
|    443 | send . . . . . . . . .  in org.apache.axis2.engine.AxisEngine
|    406 | send                    in org.apache.axis2.description.OutInAxisOperationClient
|    229 | executeImpl . . . . . . in     ''
|    165 | execute                 in org.apache.axis2.client.OperationClient
|   1960 | login . . . . . . . . . in com.zuora.api.ZuoraServiceStub
|     51 | ___init___              in com.zuora.zortal.util.ZApi$$EPbyIuau
|     48 | <init> . . . . . . . .  in com.zuora.zortal.repository.ZuoraRepository
|     40 | login                   in saaseiportal.unauthorized.LoginController
|    195 | doFilter . . . . . . .  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter                in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run                     in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . . . . . . . . in java.lang.Thread
Caused by WstxIOException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
->>  261 | flush                   in com.ctc.wstx.sw.BaseStreamWriter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     50 | flush                   in org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper
|    224 | close . . . . . . . . . in org.apache.axiom.om.impl.MTOMXMLStreamWriter
|    320 | ajc$interMethod$org_apache_axiom_om_impl_common_AxiomContainerSupport$org_apache_axiom_om_impl_common_AxiomContainer$serializeAndConsume in org.apache.axiom.om.impl.common.AxiomContainerSupport
|      1 | serializeAndConsume . . in org.apache.axiom.om.impl.llom.OMElementImpl
|     74 | writeTo                 in org.apache.axis2.transport.http.SOAPMessageFormatter
|     84 | writeRequest . . . . .  in org.apache.axis2.transport.http.AxisRequestEntity
|    499 | writeRequestBody        in org.apache.commons.httpclient.methods.EntityEnclosingMethod
|   2114 | writeRequest . . . . .  in org.apache.commons.httpclient.HttpMethodBase
|   1096 | execute                 in     ''
|    398 | executeWithRetry . . .  in org.apache.commons.httpclient.HttpMethodDirector
|    171 | executeMethod           in     ''
|    397 | executeMethod . . . . . in org.apache.commons.httpclient.HttpClient
|    621 | executeMethod           in org.apache.axis2.transport.http.AbstractHTTPSender
|    193 | sendViaPost . . . . . . in org.apache.axis2.transport.http.HTTPSender
|     75 | send                    in     ''
|    396 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender
|    223 | invoke                  in     ''
|    443 | send . . . . . . . . .  in org.apache.axis2.engine.AxisEngine
|    406 | send                    in org.apache.axis2.description.OutInAxisOperationClient
|    229 | executeImpl . . . . . . in     ''
|    165 | execute                 in org.apache.axis2.client.OperationClient
|   1960 | login . . . . . . . . . in com.zuora.api.ZuoraServiceStub
|     51 | ___init___              in com.zuora.zortal.util.ZApi$$EPbyIuau
|     48 | <init> . . . . . . . .  in com.zuora.zortal.repository.ZuoraRepository
|     40 | login                   in saaseiportal.unauthorized.LoginController
|    195 | doFilter . . . . . . .  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter                in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker . . . . . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run                     in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . . . . . . . . in java.lang.Thread
Caused by SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
->>   82 | flushBuffer             in java.io.BufferedOutputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    140 | flush                   in     ''
|    191 | flush . . . . . . . . . in org.apache.commons.httpclient.ChunkedOutputStream
|    103 | flush                   in com.ctc.wstx.io.UTF8Writer
|    225 | flush . . . . . . . . . in com.ctc.wstx.sw.BufferingXmlWriter
|    259 | flush                   in com.ctc.wstx.sw.BaseStreamWriter
|     50 | flush . . . . . . . . . in org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper
|    224 | close                   in org.apache.axiom.om.impl.MTOMXMLStreamWriter
|    320 | ajc$interMethod$org_apache_axiom_om_impl_common_AxiomContainerSupport$org_apache_axiom_om_impl_common_AxiomContainer$serializeAndConsume in org.apache.axiom.om.impl.common.AxiomContainerSupport
|      1 | serializeAndConsume     in org.apache.axiom.om.impl.llom.OMElementImpl
|     74 | writeTo . . . . . . . . in org.apache.axis2.transport.http.SOAPMessageFormatter
|     84 | writeRequest            in org.apache.axis2.transport.http.AxisRequestEntity
|    499 | writeRequestBody . . .  in org.apache.commons.httpclient.methods.EntityEnclosingMethod
|   2114 | writeRequest            in org.apache.commons.httpclient.HttpMethodBase
|   1096 | execute . . . . . . . . in     ''
|    398 | executeWithRetry        in org.apache.commons.httpclient.HttpMethodDirector
|    171 | executeMethod . . . . . in     ''
|    397 | executeMethod           in org.apache.commons.httpclient.HttpClient
|    621 | executeMethod . . . . . in org.apache.axis2.transport.http.AbstractHTTPSender
|    193 | sendViaPost             in org.apache.axis2.transport.http.HTTPSender
|     75 | send . . . . . . . . .  in     ''
|    396 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender
|    223 | invoke . . . . . . . .  in     ''
|    443 | send                    in org.apache.axis2.engine.AxisEngine
|    406 | send . . . . . . . . .  in org.apache.axis2.description.OutInAxisOperationClient
|    229 | executeImpl             in     ''
|    165 | execute . . . . . . . . in org.apache.axis2.client.OperationClient
|   1960 | login                   in com.zuora.api.ZuoraServiceStub
|     51 | ___init___ . . . . . .  in com.zuora.zortal.util.ZApi$$EPbyIuau
|     48 | <init>                  in com.zuora.zortal.repository.ZuoraRepository
|     40 | login . . . . . . . . . in saaseiportal.unauthorized.LoginController
|    195 | doFilter                in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . . .  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker               in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run                     in java.lang.Thread
Caused by SSLException: java.net.SocketException: Connection reset
->>   82 | flushBuffer             in java.io.BufferedOutputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    140 | flush                   in     ''
|    191 | flush . . . . . . . . . in org.apache.commons.httpclient.ChunkedOutputStream
|    103 | flush                   in com.ctc.wstx.io.UTF8Writer
|    225 | flush . . . . . . . . . in com.ctc.wstx.sw.BufferingXmlWriter
|    259 | flush                   in com.ctc.wstx.sw.BaseStreamWriter
|     50 | flush . . . . . . . . . in org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper
|    232 | flush                   in org.apache.axiom.om.impl.MTOMXMLStreamWriter
|    318 | ajc$interMethod$org_apache_axiom_om_impl_common_AxiomContainerSupport$org_apache_axiom_om_impl_common_AxiomContainer$serializeAndConsume in org.apache.axiom.om.impl.common.AxiomContainerSupport
|      1 | serializeAndConsume     in org.apache.axiom.om.impl.llom.OMElementImpl
|     74 | writeTo . . . . . . . . in org.apache.axis2.transport.http.SOAPMessageFormatter
|     84 | writeRequest            in org.apache.axis2.transport.http.AxisRequestEntity
|    499 | writeRequestBody . . .  in org.apache.commons.httpclient.methods.EntityEnclosingMethod
|   2114 | writeRequest            in org.apache.commons.httpclient.HttpMethodBase
|   1096 | execute . . . . . . . . in     ''
|    398 | executeWithRetry        in org.apache.commons.httpclient.HttpMethodDirector
|    171 | executeMethod . . . . . in     ''
|    397 | executeMethod           in org.apache.commons.httpclient.HttpClient
|    621 | executeMethod . . . . . in org.apache.axis2.transport.http.AbstractHTTPSender
|    193 | sendViaPost             in org.apache.axis2.transport.http.HTTPSender
|     75 | send . . . . . . . . .  in     ''
|    396 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender
|    223 | invoke . . . . . . . .  in     ''
|    443 | send                    in org.apache.axis2.engine.AxisEngine
|    406 | send . . . . . . . . .  in org.apache.axis2.description.OutInAxisOperationClient
|    229 | executeImpl             in     ''
|    165 | execute . . . . . . . . in org.apache.axis2.client.OperationClient
|   1960 | login                   in com.zuora.api.ZuoraServiceStub
|     51 | ___init___ . . . . . .  in com.zuora.zortal.util.ZApi$$EPbyIuau
|     48 | <init>                  in com.zuora.zortal.repository.ZuoraRepository
|     40 | login . . . . . . . . . in saaseiportal.unauthorized.LoginController
|    195 | doFilter                in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . . .  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker               in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run                     in java.lang.Thread
Caused by SocketException: Connection reset
->>  196 | read                    in java.net.SocketInputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    122 | read                    in     ''
|     82 | flushBuffer . . . . . . in java.io.BufferedOutputStream
|    140 | flush                   in     ''
|    191 | flush . . . . . . . . . in org.apache.commons.httpclient.ChunkedOutputStream
|    103 | flush                   in com.ctc.wstx.io.UTF8Writer
|    225 | flush . . . . . . . . . in com.ctc.wstx.sw.BufferingXmlWriter
|    259 | flush                   in com.ctc.wstx.sw.BaseStreamWriter
|     50 | flush . . . . . . . . . in org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper
|    232 | flush                   in org.apache.axiom.om.impl.MTOMXMLStreamWriter
|    318 | ajc$interMethod$org_apache_axiom_om_impl_common_AxiomContainerSupport$org_apache_axiom_om_impl_common_AxiomContainer$serializeAndConsume in org.apache.axiom.om.impl.common.AxiomContainerSupport
|      1 | serializeAndConsume     in org.apache.axiom.om.impl.llom.OMElementImpl
|     74 | writeTo . . . . . . . . in org.apache.axis2.transport.http.SOAPMessageFormatter
|     84 | writeRequest            in org.apache.axis2.transport.http.AxisRequestEntity
|    499 | writeRequestBody . . .  in org.apache.commons.httpclient.methods.EntityEnclosingMethod
|   2114 | writeRequest            in org.apache.commons.httpclient.HttpMethodBase
|   1096 | execute . . . . . . . . in     ''
|    398 | executeWithRetry        in org.apache.commons.httpclient.HttpMethodDirector
|    171 | executeMethod . . . . . in     ''
|    397 | executeMethod           in org.apache.commons.httpclient.HttpClient
|    621 | executeMethod . . . . . in org.apache.axis2.transport.http.AbstractHTTPSender
|    193 | sendViaPost             in org.apache.axis2.transport.http.HTTPSender
|     75 | send . . . . . . . . .  in     ''
|    396 | writeMessageWithCommons in org.apache.axis2.transport.http.CommonsHTTPTransportSender
|    223 | invoke . . . . . . . .  in     ''
|    443 | send                    in org.apache.axis2.engine.AxisEngine
|    406 | send . . . . . . . . .  in org.apache.axis2.description.OutInAxisOperationClient
|    229 | executeImpl             in     ''
|    165 | execute . . . . . . . . in org.apache.axis2.client.OperationClient
|   1960 | login                   in com.zuora.api.ZuoraServiceStub
|     51 | ___init___ . . . . . .  in com.zuora.zortal.util.ZApi$$EPbyIuau
|     48 | <init>                  in com.zuora.zortal.repository.ZuoraRepository
|     40 | login . . . . . . . . . in saaseiportal.unauthorized.LoginController
|    195 | doFilter                in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . . .  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker               in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run                     in java.lang.Thread
String TLS_VERSION = "TLSv1.2";
SchemeRegistry registry = new SchemeRegistry();
SSLSocketFactory socketFactory;
try {
    if (Boolean.valueOf(((String) ZConfig.getInstance().getVal("ssl.verify.peer")).toLowerCase())) {
        socketFactory = new SSLSocketFactory(TLS_VERSION, null, null, null, null, null,
                SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
    } else {
        socketFactory = new SSLSocketFactory(TLS_VERSION, null, null, null, null, new TrustStrategy() {
            @Override
            public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
                return true;
            }
        }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
    }
    // need both http and https
    registry.register(new Scheme("https", 443, socketFactory));
}