Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

TC5 java mail woes

Mark Lowe

2004-04-23

Replies:

Hello

After posting this problem yesterday I went away and assumed that the
problem must be the consequence of my IQ deficit and/or all crack
smoking..

Before I start , yes I have the java mail 1.31 and a recent copy of
javax.activation in both by webapp lib directory and common/lib

I added the context in the relevant place in sever.xml

<Context path="/acme-mail" docBase="acme-mail" debug="9"
           reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
              prefix="acme-mail." suffix=".log"
        timestamp="true"/>
   
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
 <ResourceParams name="mail/Session">
  <parameter>
    <name>mail.smtp.host</name>
    <value>out.aliceposta.it</value>
  </parameter>
 </ResourceParams>
</Context>

i also tried

<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
 <ResourceParams name="mail/Session">
  <parameter>
    <name>mail.smtp.host</name>
    <value>out.aliceposta.it</value>
  </parameter>
 </ResourceParams>

nested in <GlobalNamingResources> because it seemed a really cool
thing to do at the time and i wanted to impress my friends.

in acme-mail (the webapp) web.xml

<resource-ref>
 <description></description>
 <res-ref-name>mail/Session</res-ref-name>
 <res-type>javax.mail.Session</res-type>
 <res-auth>Container</res-auth>
</resource-ref>

after the taglib declarations as specified by the dtd
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd

when i try to grab the mail session i get this..

java.lang.NoClassDefFoundError: javax/activation/DataSource

point to the line where i try and feed session to the mime message
constructor.

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session mailSession = (Session) envCtx.lookup("mail/Session");
Message msg = new MimeMessage(mailSession);

Has no body had this problem?

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.