dcsimg
JavaMail service cannot be found via JNDI lookup, always throwing Exception...
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Markus_Mootz
Posted On:   Wednesday, November 30, 2005 05:27 AM

I'm trying to write me an eMail notifier warning me of problems on my application. What I'm doing is this: Hashtable props = new Hashtable(); props.put(Context.INITIAL_CONTEXT_FACTORY, blablabla); props.put(Context.PROVIDER_URL, blablabla); props.put(Context.URL_PKG_PREFIXES, blablabla); InitialContext ictx = new InitialContext(props); Session mailSession = (Session) ictx.lookup("java:/Mail"); But now, although my JBoss4.0.2 reports following: [MailService] Mail Service bound to java:/Mail He always throws this exception: javax.naming.NameNotFoundException:   More>>

I'm trying to write me an eMail notifier warning me of problems on my application. What I'm doing is this:


			
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, blablabla);
props.put(Context.PROVIDER_URL, blablabla);
props.put(Context.URL_PKG_PREFIXES, blablabla);
InitialContext ictx = new InitialContext(props);
Session mailSession = (Session) ictx.lookup("java:/Mail");


But now, although my JBoss4.0.2 reports following:


			
[MailService] Mail Service bound to java:/Mail


He always throws this exception:


			
javax.naming.NameNotFoundException: Mail not bound


Anybody got an idea what this n00b is doing? My nerves are getting thinner and thinner... ;-)

   <<Less

Re: JavaMail service cannot be found via JNDI lookup, always throwing Exception...

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, December 4, 2005 03:32 PM

Have you tried just looking up "Mail", or maybe "/Mail"? I don't understand how this works, but sometimes a prefix is assumed already.



(typically "java:/comp/env/" is assumed, e.g. when I lookup "/jdbc/foo" from an application, it finds the resource that is supposedly bound to "java:/comp/env/jdbc/foo:")
About | Sitemap | Contact