JNDI lookup return mail sessions with same parametres
ki6opr Mar 31, 2009 1:34 AMHi all.
We migrated from Jboss 4 to 5 and get trouble with mail sessions lookup via jndi.
Jndi lookup return instances with same parameters for two different mail session.
mail-service.xml:
<?xml version="1.0" encoding="UTF-8"?> <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@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@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@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@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>
code for lookup:
session1 = (Session) context.lookup("java:/mail/gp"); session2 = (Session) context.lookup("java:/mail/jcCrm");
On Jboss 4 and Glassfish this code return different mail session with correct parameters but on version 5 we got this issue (lookup with spring org.springframework.jndi.JndiObjectFactoryBean class return same result).
Always returned last mail session which was loaded by Jboss 5.
Thanks for any help.