0 Replies Latest reply on Sep 21, 2009 6:38 PM by Ivan Alban

    problem when deploy javamail service

    Ivan Alban Newbie

      I have the next problem.

      Now I use Jboss 5.1.0.GA, and cannot deploy a second javamail service when start jboss.

      The file name is
      custom-mail-service.xml and contains:

      <?xml version="1.0" encoding="UTF-8"?>
       <mbean code="org.jboss.mail.MailService"
       <attribute name="JNDIName">java:/Custom.Mail</attribute>
       <attribute name="User">jboss</attribute>
       <attribute name="Password">123456</attribute>
       <attribute name="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="nobody"/>
       <!-- Change to the mail server -->
       <property name="mail.pop3.host" value="localhost"/>
       <!-- Change to the SMTP gateway server -->
       <property name="mail.smtp.host" value=""/>
       <property name="mail.smtp.port" value="25"/>
       <!-- Change to the address mail will be from -->
       <!-- <property name="mail.from" value="jboss@localhost"/>-->
       <!-- Enable debugging output from the javamail classes -->
       <property name="mail.debug" value="true"/>

      When I was trying call the service using the jndi name, jboss server always returned the default javamail configuration.

      I use the next code to call my javamail service.

      try {
       InitialContext initialContext = new InitialContext();
       return (Session) initialContext.lookup("java:/Custom.Mail");
       } catch (NamingException e) {
       log.error("-> Read SMTP configuration from Server FAIL ", e);

      This happen only when jboss start for first time, In hot deployment the problem does not happen.

      Tnx for your help