[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: Multiple mail sessions

h4tr3d do-not-reply at jboss.com
Mon Mar 23 23:50:31 EDT 2009


Hi All,

We are use JBoss AS 5.0.0 and we have trouble: we create two mail-services but when try get information we got similar data for different jndi.

config:
<?xml version="1.0" encoding="UTF-8"?>
  | <!-- $Id: mail-service.xml 62349 2007-04-15 16:48:15Z dimitris at jboss.org $ -->
  | <server>
  |     <mbean code="org.jboss.mail.MailService"
  |          name="jboss:service=jcCrm">
  |     <attribute name="JNDIName">java:/mail/jcCrm</attribute>
  |     <attribute name="Configuration">
  |       <configuration>
  |         <property name="mail.transport.protocol" value="smtp"/>
  |         <property name="mail.user" value="jccrm at greenparts.ru"/>
  |         <property name="mail.password" value="<password_1>"/>
  |         <property name="mail.smtp.host" value="mail.japancar.ru"/>
  |         <property name="mail.smtp.port" value="25"/>
  |         <property name="mail.smtp.auth" value="true"/>
  |         <property name="mail.from" value="no-replay at greenparts.ru"/>
  |         <property name="mail.mime.charset" value="UTF-8"/>
  |         <property name="mail.debug" value="true"/>
  |       </configuration>
  |     </attribute>
  |     <depends>jboss:service=Naming</depends>
  |   </mbean>
  |   
  |   <mbean code="org.jboss.mail.MailService"
  |          name="jboss:service=gp">
  |     <attribute name="JNDIName">java:/mail/gp</attribute>
  |     <attribute name="Configuration">
  |       <configuration>
  |         <property name="mail.transport.protocol" value="smtp"/>
  |         <property name="mail.user" value="gp at greenparts.ru"/>
  |         <property name="mail.password" value="<password_2>"/>
  |         <property name="mail.smtp.host" value="mail.japancar.ru"/>
  |         <property name="mail.smtp.port" value="25"/>
  |         <property name="mail.smtp.auth" value="true"/>
  |         <property name="mail.from" value="no-replay at greenparts.ru"/>
  |         <property name="mail.mime.charset" value="UTF-8"/>
  |         <property name="mail.debug" value="true"/>
  |       </configuration>
  |     </attribute>
  |     <depends>jboss:service=Naming</depends>
  |   </mbean>
  | </server>

We use next part of code for getting mail-sessions:
            session1 = (Session) context.lookup("java:/mail/gp");
  |             session2 = (Session) context.lookup("java:/mail/jcCrm");
  | 
  |             if (session1 != null) {
  |                 Properties properties = session1.getProperties();
  |                 properties.list(out);
  |             }
  | 
  |             if (session2 != null) {
  |                 Properties properties = session2.getProperties();
  |                 properties.list(out);
  |             }
  | 
  |             out.write("<br> sesion1.equals(session2) = " + session1.equals(session2) + " " + "<br>");
  | 

It provide next result:

  | -- listing properties -- mail.user=gp at greenparts.ru mail.mime.charset=UTF-8 mail.transport.protocol=smtp mail.smtp.host=mail.japancar.ru mail.debug=true mail.from=no-replay at greenparts.ru mail.smtp.port=25 mail.smtp.auth=true mail.password=<pass_1>
  | 
  | -- listing properties -- mail.user=gp at greenparts.ru mail.mime.charset=UTF-8 mail.transport.protocol=smtp mail.smtp.host=mail.japancar.ru mail.debug=true mail.from=no-replay at greenparts.ru mail.smtp.port=25 mail.smtp.auth=true mail.password=<pass_1> 
  | sesion1.equals(session2) = false
  | 

So, we can see, that for two different jndi we got similar values. Also, this code work fine on JBoss AS 4.2.3.GA

Any ideas?


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

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



More information about the jboss-user mailing list