在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 truststore文件)
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
- adding
JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=/home/stewert.c-on/data/projects/keystore/devel.truststore -Djavax.net.ssl.trustStorePassword=123456"
to:- 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".
他们的方法是在服务器配置XML的
system-properties
元素中进行设置,对我来说,这似乎也是最好的方法.胜过在运行配置文件中花时间!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屋!