在 JBoss 7 中设置正确的信任库 [英] Setting the right truststore in JBoss 7
问题描述
我想从 JBoss 7 应用程序发送电子邮件.SMTP 服务器需要带有自签名证书的 TLS 连接.如果我尝试发送电子邮件,我会收到 SSLHandshakeException,因为无法检查服务器证书.为了解决这个问题,我添加了这个:http://springinpractice.com/2012/04/29/fixing-pkix-path-building-issues-when-using-javamail-and-smtp/(将 SMTP 服务器证书放入java 信任库文件)
I want to send EMails from a JBoss 7 application. The SMTP server needs a TLS connection with a self signed certificate. If I try to send a EMail I get a SSLHandshakeException because the server certificate cannot be checked. To fix this I have add this: http://springinpractice.com/2012/04/29/fixing-pkix-path-building-issues-when-using-javamail-and-smtp/ (putting the SMTP server certificate into a java truststore file)
我现在的问题是如何将信任库文件设置为 JBoss 7?
My problem is now how to set the truststore file to JBoss 7?
我知道在 stackoverflow 和其他论坛上有几个针对该问题的答案.但我没有找到合适的.
I known at stackoverflow and on other forums there are several answer for that propblem. But I didn't found the right.
我已经尝试过以下方法:
I have already tried followings:
- 添加
JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=/home/stewert.c-on/data/projects/keystore/devel.truststore -Djavax.net.ssl.trustStorePassword=123456"
到:- jboss-as-7.1.1.Final/bin/standalone.conf
- jboss-as-7.1.1.Final/bin/domain.conf
- jboss-as-7.1.1.Final/bin/appclient.conf
但是,如果我在运行时使用System.getProperty("javax.net.ssl.trustStore")"检查系统环境变量,我在每种情况下都会得到 null!
But if I check at runtime the system environment variable with 'System.getProperty("javax.net.ssl.trustStore")' I get in every case null!
我的环境:
- Linux
- JBoss 7.1
- JDK 7
- 我正在 eclipse Juno 中启动 JBoss
有人知道出了什么问题吗?我必须在哪里设置信任库?
Anybody knows what's going wrong? Where must I set the truststore?
谢谢,史蒂芬
推荐答案
JBoss 论坛上有人问javax.net.ssl.trustStore - 指定客户端信任的唯一方法?",答案基本上是是".
Someone asked on the JBoss forum "javax.net.ssl.trustStore - only way to specify client trust?", and the answer is basically "yes".
他们的方法是在
system-properties
中设置服务器配置 XML 中的元素,这对我来说似乎也是最好的方法.比在运行配置文件中乱搞要好!Their approach was to set that in a
system-properties
element in the server config XML, which seems like the best way to me too. Better than grubbing about in the run configuration files!这篇关于在 JBoss 7 中设置正确的信任库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!