× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is a multi-part message in MIME format.
--


Dear Sir Plz Help me. Actually i have a simple servlet which recieve
parameters from the HTML page and by using these parameters it sends Email
but when i run this class file it give Internal Servlet error which is:
Internal Servlet Error:
java.lang.NoClassDefFoundError: javax/mail/Message
        at java.lang.Class.getMethodInfo0(Native Method)
        at java.lang.Class.getMethodInfo(Class.java:1819)
        at java.lang.Class.getConstructors1(Class.java:1761)
        at java.lang.Class.getConstructors0(Class.java:1745)
        at java.lang.Class.getConstructor0(Class.java:1782)
        at java.lang.Class.newInstance0(Class.java:261)
        at java.lang.Class.newInstance(Class.java:249)
        at
org.apache.tomcat.facade.ServletHandler.getServlet(ServletHandler.java:346)
        at 
org.apache.tomcat.facade.ServletHandler.preInit(ServletHandler.java:439)
        at org.apache.tomcat.facade.ServletHandler.init(ServletHandler.java:228)
        at 
org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:472)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
        at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
        at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
        at java.lang.Thread.run(Thread.java:579)


I have been also attached the java source code. If any body also known this
run time exception please help me. Thx
Tariq Mahmood





_________________________________________________________________
Unlimited Internet access for only $21.95/month.  Try MSN!
http://resourcecenter.msn.com/access/plans/2monthsfree.asp
--
import javax.mail.*;
import javax.activation.*;
import javax.mail.internet.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

  /* A simple email sender class. */

public class EmailNotification extends HttpServlet {

private static final String CONTENT_TYPE = "text/html";

public void service(HttpServletRequest request, HttpServletResponse
response) throws ServletException,IOException
{
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();

String smtpServer=request.getParameter("smtpServer");
String user=request.getParameter("user");
String password=request.getParameter("password");
String from=request.getParameter("sender");
String to=request.getParameter("recipients");
String subject=request.getParameter("subject");
String bodyText=request.getParameter("body");


        /*out.println(smtpServer);
        out.println(user);
        out.println(password);
        out.println(from);
        out.println(to);
        out.println(subject);
        out.println(body);
         */
//call method to send the mail.
send(request,response,smtpServer,to,from,subject,bodyText,user,password);
}//Service method closing


//definition of Send method
public void send(HttpServletResponse response, String smtpServer, String to,
String from, String subject, String bodyText,String user,String password) {
PrintWriter out=response.getWriter();

try{
Properties props = System.getProperties();
// -- Attaching to default Session, or we could start a new one --
props.put("mail.smtp.host", smtpServer);
Session session = Session.getDefaultInstance(props, null);

// -- Create a new message --
Message msg = new MimeMessage(session);

      // -- Set the FROM and TO fields --
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,
        InternetAddress.parse(to, false));

// -- We could include CC recipients too --
// if (cc != null)
// msg.setRecipients(Message.RecipientType.CC
// ,InternetAddress.parse(cc, false));

      // -- Set the subject and body text --
msg.setSubject(subject);
msg.setText(bodyText);

// -- Set some other header information --
msg.setHeader("X-Mailer", "Virtual University");
msg.setSentDate(new Date());

msg.saveChanges(); // Save messeg for transportaion.
//Connect to Mail Server
Transport transport = session.getTransport ("smtp");
transport.connect(smtpServer, user, password);
msg.saveChanges();

      // -- Send the message --
Transport.send(msg);
out.println("Message sent OK.");
}//try closing

catch(Exception e){
out.println(e.toString());
}

  }//send method closing
}//Class closing





As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.