[jboss-user] [JNDI and Naming] - problem when deploy javamail service
j.predator
do-not-reply at jboss.com
Mon Sep 21 18:38:20 EDT 2009
Hi
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"?>
| <server>
| <mbean code="org.jboss.mail.MailService"
| name="jboss:service=CustomMail">
| <attribute name="JNDIName">java:/Custom.Mail</attribute>
| <attribute name="User">jboss</attribute>
| <attribute name="Password">123456</attribute>
| <attribute name="Configuration">
| <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="10.0.0.51"/>
| <property name="mail.smtp.port" value="25"/>
|
| <!-- Change to the address mail will be from -->
| <!-- <property name="mail.from" value="jboss at localhost"/>-->
|
| <!-- Enable debugging output from the javamail classes -->
| <property name="mail.debug" value="true"/>
| </configuration>
| </attribute>
| <depends>jboss:service=Naming</depends>
| </mbean>
| </server>
|
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
Atte.
Ivan
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256271#4256271
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256271
More information about the jboss-user
mailing list