[jboss-user] [Beginners Corner] - JavaMail JNDI Problem

wcydaip do-not-reply at jboss.com
Wed Aug 20 13:45:32 EDT 2008


I am trying to setup the example jar from javamail1.4 within JBoss, but, I keep having problems linking my war to the appropriate JNDI value or setting the JNDI resource explicitly.  I'm using JBoss4.0.3RC1

The following is the error:

  |         ... 62 more
  | 10:39:12,031 ERROR [MainDeployer] Could not start deployment: file:/C:/jboss-4.0
  | .3SP1-FRESH/server/default/deploy/javamail.war
  | org.jboss.deployment.DeploymentException: Error during deploy; - nested throwabl
  | e: (javax.naming.NamingException: resource-ref: MySession has no valid JNDI bind
  | ing. Check the jboss-web/resource-ref.)
  | 

I'm not sure what is meant by the jboss-web/resource-ref.  I've taken a guess that it means a jboss-web.xml file, but, then again, I'm not sure which jboss-web.xml file I'm supposed edit.

web.xml

  |   <resource-ref>
  |     <res-ref-name>MySession</res-ref-name>
  |     <res-type>javax.mail.Session</res-type>
  |     <jndi-name>java:/NetaMail</jndi-name>
  |     <res-auth>Container</res-auth>
  |   </resource-ref>
  | 

default/deploy/mail-service.xml

  |   <mbean code="org.jboss.mail.MailService"
  |          name="jboss:service=Mail">
  |     <attribute name="JNDIName">java:/NetaMail</attribute>
  |     <attribute name="User">###</attribute>
  |     <attribute name="Password">###</attribute>
  |     <attribute name="Configuration">
  |        <!-- Test -->
  |        <configuration>
  |           <!-- Change to your mail server prototocol -->
  |           <property name="mail.store.protocol" value="imap"/>
  |           <property name="mail.transport.protocol" value="smtp"/>
  | 
  |           <!-- Change to the user who will receive mail  -->
  |           <property name="mail.user" value="###"/>
  | 
  |           <!-- Change to the mail server  -->
  |           <property name="mail.pop3.host" value="###"/>
  | 
  |           <!-- Change to the SMTP gateway server -->
  |           <property name="mail.smtp.host" value="###"/>
  | 
  |           <!-- Change to the address mail will be from  -->
  |           <property name="mail.from" value="neta@###.com"/>
  | 
  |           <!-- Enable debugging output from the javamail classes -->
  |           <property name="mail.debug" value="true"/>
  |        </configuration>
  |        <depends>jboss:service=Naming</depends>
  |     </attribute>
  |   </mbean>
  | 

and I tried the server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml
but to no avail:

  |          <resource-ref>
  |               <res-ref-name>MySession</res-ref-name>
  |               <res-type>javax.mail.Session</res-type>
  |               <jndi-name>java:/NetaMail</jndi-name>
  |               <res-auth>Container</res-auth>
  |   </resource-ref>
  | 

Can anyone tell me where I'm messing up?

Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171585#4171585

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171585



More information about the jboss-user mailing list