You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by e-Denton Subscriber <su...@e-denton.com> on 2004/07/07 16:49:21 UTC

Tomcat 5.0 and JavaMail

I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having trouble. I
know it's something simple, perhaps you can see the problem. Mail.jar is in
Tomcat 5.0\common\lib.

I am getting this error:

"javax.naming.NamingException: Cannot create resource instance:"

Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml

"<Context displayName="Portal Application"
         debug="5"
         docBase="e-Denton"
         path="/e-Denton"
         reloadable="true"
         useNaming="true">

    <Loader checkInterval="1" />

 <Resource name="mail/Session" auth="Container" type="javax.mail.Session" />
 <ResourceParams name="mail/Session">
  <parameter>
   <name>mail.smtp.host</name>
   <value>mars.webappcabaret.net</value>
  </parameter>
 </ResourceParams>
..."

And this web.xml:

"<!-- JavaMail Resource -->
 <resource-ref>
  <description>
  Resource reference to a factory for javax.mail.Session
  preconfigured to connect to the appropriate SMTP server.
  </description>
  <res-ref-name>mail/Session</res-ref-name>
  <res-type>javax.mail.Session</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>"

Accessed like this:

  "try
   {
   Context initContext = new InitialContext();
   Context envContext  = (Context) initContext.lookup("java:comp/env");
   Session session = (Session) envContext.lookup("mail/Session");
   }
  catch (javax.naming.NamingException ne)"






---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org