简体   繁体   English

Web服务调用EJB创建SSL异常

[英]Webservice calling EJB creates SSL exception

I have a JAX-WS webservice which makes calls to a remote EJB on the same server. 我有一个JAX-WS Web服务,该服务在同一服务器上调用远程EJB。 Everything runs on Glassfish 3.1.1, and the apps are deployed EARs – one for the webservice, another for the EJB. 一切都在Glassfish 3.1.1上运行,并且应用程序已部署EAR-一个用于Web服务,另一个用于EJB。 This works fine locally, but when deploying to a test server, I get typical exceptions about untrusted (self-signed) SSL certificates. 这在本地可以正常工作,但是当部署到测试服务器时,我会遇到有关不受信任(自签名)SSL证书的典型异常。 Here's a relevant excerpt: 以下是相关摘录:

Caused by: com.sun.xml.ws.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:132)

The exception occurs exactly on the line in the webservice where the EJB call is being made. 异常恰好发生在进行EJB调用的Web服务中的行上。 It puzzles me because I wouldn't expect anything to do with HTTPS at that point. 这让我感到困惑,因为那时我不希望与HTTPS有任何关系。

The most promising angle so far is that this has to do with transaction coordination, as described here , which is supposed to use HTTPS by default. 最有希望的角度到目前为止,这与事务协调办,描述在这里 ,这是应该默认使用HTTPS。 However, setting com.sun.xml.ws.tx.preferredScheme=http has no effect on the problem. 但是,设置com.sun.xml.ws.tx.preferredScheme = http对此问题没有影响。

Any suggestion is much appreciated. 任何建议深表感谢。

This is because the client does not know which truststore it should use - so therefore it does not trust the service and the SSL handshake fails. 这是因为客户端不知道客户端应使用哪个信任库-因此它不信任服务,并且SSL握手失败。 Run the 'client' with the following VMargs: 使用以下VMargs运行“客户端”:

-Djavax.net.ssl.trustStore=${truststore.location}
-Djavax.net.ssl.trustStorePassword=${ssl.password}

If you use NetBeans it can be set at project properties. 如果使用NetBeans,则可以在项目属性中进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM