现在我必须迁移一个应用程序。
基本配置:
- JBOSS 5.1.0 正式版
- 接缝 2.2.0.GA
- JBPM 3.2.2
- RichFaces 3.3.1.GA
- 休眠 3.3.1.GA
- 操作系统:Debian/Linux
应用程序已部署在具有自己配置的 JBoss 服务器上。在旧机器上,有用于发送消息的后缀(本地主机,端口 25)。
在新机器上我有不同的主机和端口。
我现在在components.xml中有什么:
<mail:mail-session session-jndi-name="java:/Mail" />
我的mail-service.xml:
<mbean code="org.jboss.mail.MailService"
name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">XXX</attribute>
<attribute name="Password">XXX</attribute>
<attribute name="Configuration">
<!-- A test configuration -->
<configuration>
<!-- Change to your mail server prototocol -->
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtp"/>
<!-- Change to the user who will receive mail -->
<property name="mail.user" value="XXX"/>
<!-- Change to the mail server -->
<property name="mail.pop3.host" value="localhost"/>
<!-- Change to the SMTP gateway server -->
<property name="mail.smtp.host" value="XXX"/>
<property name="mail.smtp.auth" value="true"></property>
<property name="mail.smtp.ssl.enable" value="false"></property>
<property name="mail.smtp.port" value="587"/>
<property name="mail.smtp.connectiontimeout" value="20000"></property>
<property name="mail.smtp.timeout" value="20000"></property>
<!-- The mail server port -->
<!-- Change to the address mail will be from -->
<property name="mail.from" value="XXX"/>
<!-- Enable debugging output from the javamail classes -->
<property name="mail.debug" value="true"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
我只对发送消息感兴趣。
但仍然:
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
<xxx>
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 59 more
当然连接被拒绝,因为应用程序仍然指向 localhost:25。我尝试使用 grep 查找其他配置、分配等。邮件服务已启动(jmx-console 信息)。它看起来仍然像应用程序没有正确配置但使用默认值.. 有什么问题?
PS:我不是JBoss的专家。我在此托管服务器上没有 root 帐户。