2015-11-20 34 views
0

我遵循了JBoss Web - JNDI資源操作方法,但仍然在郵件/會話中收到無效的JNDI綁定錯誤。以下是關聯文件中的條目。 網絡應用名稱是goDog。 的jboss-web.xml中:jboss JNDI設置失敗 - 沒有有效的JNDI綁定

<jboss-web> 
      <context-root>goDog</context-root> 
    </jboss-web> 

WEB-INF/web.xml文件片段:

<resource-ref> 
     <description> 
      Resource reference to a factory for javax.mail.Session 
      instances that may be used for sending electronic mail 
      messages, preconfigured to connect to the appropriate 
      SMTP server. 
     </description> 
     <res-ref-name> 
      mail/Session 
     </res-ref-name> 
     <res-type> 
      javax.mail.Session 
     </res-type> 
     <res-auth> 
      Container 
     </res-auth> 
    </resource-ref> 

META-INF/context.xml中:

<?xml version="1.0" encoding="UTF-8"?> 
    <Context> 
    <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="<themailserver>" />   
    </Context> 

我明白任何指導。 上次毛刺卡在我的襪子上,以便成功部署。

回答

0

我已經確定了JBoss的解決方案(4.2,是的,我知道,很老的)JNDI郵件資源配置。 以下是分辨率。 1.在\ WEB-INF一個資源引用(erence)入口/ web.xml中:

<resource-ref> 
     <description> 
      Resource reference to a factory for javax.mail.Session 
      instances that may be used for sending electronic mail 
      messages, preconfigured to connect to the appropriate 
      SMTP server. 
     </description> 
     <res-ref-name>mail/Session</res-ref-name> 
     <res-type>javax.mail.Session</res-type> 
     <res-auth>Container</res-auth> 
</resource-ref> 
  • 在JBoss中間文件\ WEB-INF的條目/的jboss-web.xml中的web.xml中的resource-ref(erence)連接到JNDI JBoss的郵件服務:

    郵件/會話 的java:/郵件

  • 在JBoss的郵件資源文件的更新server \\ deploy \ mail_service.xml(mail.smtp.host屬性):

    的java:/郵件 無人 密碼 JBoss的:服務=命名