Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

com.sun.mail.util.MailLogger

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
friends i am having this error Help me to rectify it.

am using all jar files correctly

java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger

<%
String emailid = "xxxxxxxx";
String key = "bfskjbfskjdbnf";
String host = "smtp.gmail.com";
final String from = "xxxxxxx";
final String psd = "xxxxxxx";
String sub = "Sending Password";
String body = "Thank you for Register"
+ " Userid = "+emailid +" and Password = "+key;
// Properties props = System.getProperties();
Properties props= new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");


Session mailSession = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(from, psd);
}
});

mailSession.setDebug(true);
Message msg = new MimeMessage(mailSession);
//Message msg = new MimeMessage(mailSession);
try{
msg.setFrom(new InternetAddress(from));
InternetAddress add[] = {new InternetAddress(emailid)};
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(emailid));
msg.setSubject(sub);
msg.setText(body);
Transport.send(msg);
System.out.println("send success!");

}
catch(MessagingException ex)
{
ex.printStackTrace();
}
//Transport trans = session.getTransport("smtp");
//Transport.send(msg);
//Transport.send(msg);
//ending sending mail code





%>
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

am using all jar files correctly


Apparently not.

java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger


Where is the jar file that contains this class?
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I explained in your previous thread you cannot easily debut code while it is the middle of a JSP. You need to extract it into a class separate from the JSP then it can be tested and debugged with a simple main program ind invoked from the JSP when it has been debugged.

P.S. Why have you posted this in the Security forum?
 
nagarajan nk
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my error


SEVERE: Servlet.service() for servlet [jsp] in context with path [/LifecareHospital] threw exception [javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger] with root cause
java.lang.ClassNotFoundException: com.sun.mail.util.MailLogger
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
at javax.mail.Session.initLogger(Session.java:221)
at javax.mail.Session.<init>(Session.java:206)
at javax.mail.Session.getInstance(Session.java:242)
at org.apache.jsp.sendmail_jsp._jspService(sendmail_jsp.java:116)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
 
nagarajan nk
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends dont get anger on me really i dont know your questions pl tell me briefly what i have to do
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have received several messages (see the "My Purple Mooseages" link above), you now need to do what they tell you instead of ignoring them. Do not post again before you follow the latest one, or your account will be closed permanently.
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:

java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger


Where is the jar file that contains this class?

 
I've never won anything before. Not even a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic