Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTTP Status 500 - Unable to compile class for JSP:

type Exception report

message Unable to compile class for JSP:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: [25] in the generated java file: [D:\sachin\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\Contact\org\apache\jsp\contact_005fpost_jsp.java]
Only a type can be imported. javax.mail.Session resolves to a package

An error occurred at line: [26] in the generated java file: [D:\sachin\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\Contact\org\apache\jsp\contact_005fpost_jsp.java]
Only a type can be imported. javax.mail.Transport resolves to a package

An error occurred at line: [27] in the generated java file: [D:\sachin\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\Contact\org\apache\jsp\contact_005fpost_jsp.java]
Only a type can be imported. javax.mail.PasswordAuthentication resolves to a package

An error occurred at line: 22 in the jsp file: /contact_post.jsp
Session cannot be resolved to a type
19: props.put("mail.smtp.auth", "true");
20: props.put("mail.smtp.port", "465");
21:
22: Session session1 = Session.getDefaultInstance(props,
23: new javax.mail.Authenticator() {
24: protected PasswordAuthentication getPasswordAuthentication() {
25: return new PasswordAuthentication("pdpraful@gmail.com","9595matrix1pdon");//change accordingly


An error occurred at line: 22 in the jsp file: /contact_post.jsp
Session cannot be resolved
19: props.put("mail.smtp.auth", "true");
20: props.put("mail.smtp.port", "465");
21:
22: Session session1 = Session.getDefaultInstance(props,
23: new javax.mail.Authenticator() {
24: protected PasswordAuthentication getPasswordAuthentication() {
25: return new PasswordAuthentication("pdpraful@gmail.com","9595matrix1pdon");//change accordingly


An error occurred at line: 23 in the jsp file: /contact_post.jsp
javax.mail.Authenticator cannot be resolved to a type
20: props.put("mail.smtp.port", "465");
21:
22: Session session1 = Session.getDefaultInstance(props,
23: new javax.mail.Authenticator() {
24: protected PasswordAuthentication getPasswordAuthentication() {
25: return new PasswordAuthentication("pdpraful@gmail.com","9595matrix1pdon");//change accordingly
26: }


An error occurred at line: 31 in the jsp file: /contact_post.jsp
MimeMessage cannot be resolved to a type
28:
29: //compose message
30: try {
31: MimeMessage message = new MimeMessage(session1);
32: //message.setFrom(new InternetAddress("tushshirsath@gmail.com"));//change accordingly
33: message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
34: message.setSubject(subject);


An error occurred at line: 31 in the jsp file: /contact_post.jsp
MimeMessage cannot be resolved to a type
28:
29: //compose message
30: try {
31: MimeMessage message = new MimeMessage(session1);
32: //message.setFrom(new InternetAddress("tushshirsath@gmail.com"));//change accordingly
33: message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
34: message.setSubject(subject);


An error occurred at line: 33 in the jsp file: /contact_post.jsp
Message.RecipientType.TO cannot be resolved to a type
30: try {
31: MimeMessage message = new MimeMessage(session1);
32: //message.setFrom(new InternetAddress("tushshirsath@gmail.com"));//change accordingly
33: message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
34: message.setSubject(subject);
35: message.setText(message1);
36:


An error occurred at line: 33 in the jsp file: /contact_post.jsp
InternetAddress cannot be resolved to a type
30: try {
31: MimeMessage message = new MimeMessage(session1);
32: //message.setFrom(new InternetAddress("tushshirsath@gmail.com"));//change accordingly
33: message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
34: message.setSubject(subject);
35: message.setText(message1);
36:


An error occurred at line: 38 in the jsp file: /contact_post.jsp
Transport cannot be resolved
35: message.setText(message1);
36:
37: //send message
38: Transport.send(message);
39:
40: System.out.println("message sent successfully...............");
41:


An error occurred at line: 42 in the jsp file: /contact_post.jsp
MessagingException cannot be resolved to a type
39:
40: System.out.println("message sent successfully...............");
41:
42: } catch (MessagingException e) {throw new RuntimeException(e);}
43:
44:
45:


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.52 logs.

Apache Tomcat/7.0.52
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900