1 Reply Latest reply on May 31, 2005 2:14 PM by Frank Langelage

    Mail with JBoss

    Karol Oslowski Newbie

      Hi all!
      I'm trying to write my first Message Driven bean which is supposed to send emails. But I'm having problems with resourse references. Every time I'm deploying it I receive the message:
      "12:51:32,133 WARN [MessageDrivenContainer] No resource manager found for mail/myapp/myMail"
      The XDoclet code describing this resource reference looks as below:

       * @ejb.resource-ref
       * res-ref-name="mail/myapp/myMail"
       * res-type="javax.mail.Session"
       * res-auth="Container"
       * jndi-name="java:/Mail"
      

      I've also added a "my-mail-service.xml" to the deploy directory file which is basically the same as mail-service.xml except the lines that I'm citing below:
       <mbean code="org.jboss.mail.MailService"
       name="jboss:service=myMail">
       <attribute name="JNDIName">java:/comp/env/mail/myapp/myMail</attribute>
      


      I suppose I'm doing some stupid mistake or I don't understand how resource managers work in jboss.

      I would be very grateful for any help.

      I'm using the 4.0.2 serwer version.

      kind regards

      Karol Oslowski

        • 1. Re: Mail with JBoss
          Frank Langelage Master

          Why do you want to use another jndi-name ? Why not simply use the given name java:/Mail ?

          We use a stateless session bean for sending mails with this config and programming:

          * @ejb.resource-ref
           * res-ref-name="Mail"
           * res-type="javax.mail.Session"
           * res-auth="Container"
           * @jboss.resource-ref
           * res-ref-name="Mail"
           * jndi-name="java:/Mail"

          ...
          session = ServiceLocator.getInstance().getSession( "java:comp/env/Mail" );

          ...
          As you can see, res-ref-name defines the the name under java:comp/env to use for accessing the ressource.
          jndi-name is the name of the mail service in the jndi tree.