Hi,
I have a similar question as yours. I set everything (classpath..etc), restart the web 
server and I still get ClassNotFound error just like yours.


What I did was I unzip the jar files (both mail.jar and activation.jar) into the 
servlet directory (where all the servlet class files are)
Everything just works....after that.
I know it sounds stupid, but it solved the problem. I am able to send email with 
attachment to myself from my servlet.

So you may want to give it a try. I know it is not the best solution but at least 
solve my problem.

Amy


Soumya Govardhana wrote:

> I'm sending mail to client by following code but getting error message saying that 
>mail/Messgae class not found.I ve set classapth to both mail.jar and activation.jar 
>files too. Even I did jar xvf mail.jar etc. Still I' receiving same error message. 
>What could be the reason. WHere as same code is working fine with servlet runner. On 
>server we have IIS5.0 with ServletExec and java APIs (jdk,javamail,java activationa 
>and java servlet APIs). Please send reply.
> Thank you,
> soumya.
>
>  String mailhost = new String("mail.infosysinternational.com");
>    //mail.infosysinternational.com
>    String from      = new String("[EMAIL PROTECTED]");
>    String message =new String("Dear " + firstName + " " + lastName + "\n\n" +
>       "i-TimeSheet account with Administrator privileges for your organization is 
>created successfully !  \n" +
>       "Your username is:    " + userName + "\n" +
>       "Your password is:    " + passWord + "\n\n\n" +
>       "Information about Your Organization is recorded as follows:\n" +
>       "Name       : " + organization + "\n" +
>       "Address    : " + address1 + ", " + address2 + "\n" +
>          "             " + city + ", " + state + "-" + Zip + "\n" +
>       "Phone      : " + Phone + "\n" +
>       "Fax        : " + FAX + "\n" +
>       "# empl.    : " +  "\n\n" +
>       "Thank you for your interest in Timesheet !") ;
>    String subject = new String("Registation Confirmation for " + organization);
>    //  sending confirmation mail to given mail address
>   if ((E_mail != null)&&(E_mail.length() > 0))
>   {
>    Properties props = new Properties();
>
>    props.put("mail.smtp.host", mailhost);
>          Session session = Session.getDefaultInstance(props, null);
>    session.setDebug(true);
>    Message msg = new MimeMessage(session);
>    msg.setFrom(new InternetAddress(from));
>    msg.addRecipients(Message.RecipientType.TO,
>          InternetAddress.parse(E_mail, false));
>    msg.addRecipients(Message.RecipientType.BCC,
>          InternetAddress.parse(from, false));
>    msg.setSubject(subject);
>    msg.setSentDate(new Date());
>    msg.setText(message);
>
>    msg.setHeader("X-Mailer", "Registration");
>
>    Transport.send(msg);
>
>    System.out.println("\n---> Mail was sent successfully.");
>   }
>   else
>   { System.out.println("Wrong e_mail address unable to send mail " );
>   }
>
> error Message
>   Error. The server encountered an unexpected condition which prevented it from 
>fulfilling the request.
> java.lang.NoClassDefFoundError: javax/mail/Message
>  at java.lang.ClassLoader.resolveClass0(Native Method)
>  at java.lang.ClassLoader.resolveClass(ClassLoader.java:545)
>  at newatlanta.servletexec.ServletClassLoader.loadClass(ServletClassLoader.java, 
>Compiled Code)
>  at 
>newatlanta.servletexec.HostServletContext.loadUnconfiguredServlet(HostServletContext.java)
>  at newatlanta.servletexec.ServletExec.processServletRequest(ServletExec.java)
>  at newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java, Compiled 
>Code)
>  at newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.java
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--
>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<>*<
   _
 _/ \
/0_ 0 ))))_________Amy Wan

MacDonald Dettwiler
13800 Commerce Parkway, Richmond, BC
Tel: 231-3208    Email: [EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to