You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/11/11 13:49:55 UTC

DO NOT REPLY [Bug 43834] New: - Jsp not able to find and compile Java Class Code

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43834>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43834

           Summary: Jsp not able to find and compile Java Class Code
           Product: Tomcat 5
           Version: 5.5.24
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: bhavika84@yahoo.com


I have a java class code , placed in the path C:\Program Files\Apache Software 
Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes\mail\jspemailjava.java

where mail is the package and the java code is 

package mail;

import javax.mail.*;
import javax.mail.internet.*;


import java.util.Properties;

public class jspemailjava {
    public void execute() throws Exception{

      boolean debug = true;	

      Properties props = new Properties();

      props.setProperty("mail.transport.protocol", "smtp");
      props.setProperty("mail.smtp.host", "smtp.gmail.com");
      props.put("mail.smtp.port","587");	
      props.setProperty("mail.smtp.user", "bhavika84@gmail.com");
      props.setProperty("mail.smtp.password", "ecosystem2007");
      props.put("mail.smtp.starttls.enable","true");
      props.put("mail.smtp.auth", "true");
      props.put("mail.debug", "true");
 
     
     Session mailSession = Session.getDefaultInstance(props,new 
javax.mail.Authenticator() {
 
                    	protected PasswordAuthentication 
getPasswordAuthentication() {
                        return new PasswordAuthentication
("bhavika84@gmail.com", "ecosystem2007");
                    							
	     }
                                                                               
             });
 
      //mailSession.setDebug(debug);

      Transport transport = mailSession.getTransport();
      
      MimeMessage message = new MimeMessage(mailSession);

      message.setSubject("Testing javamail plain");
      message.setContent("This is a test", "text/plain");
      message.addRecipient(Message.RecipientType.TO,
      new InternetAddress("bhavika84@gmail.com"));

      message.setFrom(new InternetAddress("bhavika84@gmail.com"));	

      transport.connect();
      transport.sendMessage(message,
      message.getRecipients(Message.RecipientType.TO));
      transport.close();
    }


}

The jsp file to invoke the java code is placed in the path C:\Program 
Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\sendmail\mail.jsp, 
the jsp code is 

<%@ page import="mail.*"%>

<%

<jsp:useBean id="email" type="jspemailjava" scope="page">
<jsp:getProperty name="email" property="name"/>
</jsp:useBean>

%>

<html> 
<p align="center"> 
<% email.execute(); %>
A Message has been sent. <br> 
Check your inbox. 
</p> 

<p align="center"> 

</p> 

</html> 

When i run the mail.jsp, i get the following error. Please can u help me as to 
how to solve the problem. Urgently required to complete my project.

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP: 
JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 5 in the jsp file: /sendmail/mail.jsp
Syntax error on token(s), misplaced construct(s)
2: 
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 5 in the jsp file: /sendmail/mail.jsp
Syntax error, insert "AssignmentOperator ArrayInitializer" to complete 
ArrayInitializerAssignement
2: 
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 5 in the jsp file: /sendmail/mail.jsp
Syntax error, insert ";" to complete Statement
2: 
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 5 in the jsp file: /sendmail/mail.jsp
Syntax error, insert ";" to complete Statement
2: 
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 5 in the jsp file: /sendmail/mail.jsp
Syntax error, insert ";" to complete Statement
2: 
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 5 in the jsp file: /sendmail/mail.jsp
Syntax error on token(s), misplaced construct(s)
2: 
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 6 in the jsp file: /sendmail/mail.jsp
Syntax error on token ":", ; expected
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 
9: %>

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 6 in the jsp file: /sendmail/mail.jsp
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 
9: %>

JSP FileName:/sendmail/mail.jsp
Java FileName:/C:/Program Files/Apache Software Foundation/Tomcat 
5.5/work/Catalina/localhost/_//org/apache/jsp/sendmail\mail_jsp.java

An error occurred at line: 6 in the jsp file: /sendmail/mail.jsp
Syntax error on tokens, delete these tokens
3: <%
4: 
5: <jsp:useBean id="email" type="jspemailjava" scope="page">
6: <jsp:getProperty name="email" property="name"/>
7: </jsp:useBean>
8: 
9: %>


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError
(DefaultErrorHandler.java:98)
	org.apache.jasper.compiler.ErrorDispatcher.javacError
(ErrorDispatcher.java:330)
	org.apache.jasper.compiler.JDTCompiler.generateClass
(JDTCompiler.java:435)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
	org.apache.jasper.JspCompilationContext.compile
(JspCompilationContext.java:564)
	org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:302)
	org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:329)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 43834] - Jsp not able to find and compile Java Class Code

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43834>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43834


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2007-11-11 05:04 -------
You need to provide the compiled class. Use the users list if you need more help.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org