[jboss-user] [JNDI/Naming/Network] - newbie please help: using the right name?
bezdomny
do-not-reply at jboss.com
Wed Oct 4 15:32:00 EDT 2006
This is a really dumb question, but here goes: I'm trying to use javamail and I have the following config:
Here is the server output when jboss starts up:
[org.jboss.mail.MailService] Mail Service bound to java:/AppMail
2006-10-04 12:46:46,065 DEBUG [org.jboss.mail.MailService] Started jboss:service=Mail
java:/AppMail
<!-- Change to your mail server prototocol -->
<!-- Change to the user who will receive mail -->
<!-- Change to the mail server -->
<!-- Change to the mail server -->
Now if you notice I've called the jndi name java:/AppMail. How do I refer to this in the code? I always get NameNotFoundException. Here is my code:
Context ctx = null;
Session mailSession = null;
try {
ctx = (Context) new InitialContext().lookup("java:comp/env");
Object objref = ctx.lookup("java:/AppMail");
mailSession = (Session) PortableRemoteObject.narrow(objref, Session.class);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace( }
Am I refering to jndi name in the proper way?
Thanks,
B
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976144#3976144
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976144
More information about the jboss-user
mailing list