更改JBoss Mail服务的默认配置时出现问题

时间:2012-08-31 14:37:42

标签: email java-ee jboss

现在我必须迁移一个应用程序。

基本配置:

  1. JBOSS 5.1.0 GA
  2. Seam 2.2.0.GA
  3. JBPM 3.2.2
  4. RichFaces 3.3.1.GA
  5. Hibernate 3.3.1.GA
  6. 操作系统:Debian / Linux
  7. 应用程序已部署在具有自己配置的JBoss服务器上。 在旧机器上有postfix(localhost,端口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 info)。仍然看起来像应用程序没有正确配置但使用默认值..什么错了?

    PS:我不是JBoss的专家。我在这个托管服务器上没有root帐户。

0 个答案:

没有答案