aspose file tools*
The moose likes JSP and the fly likes How to access a JSP Page-Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to access a JSP Page-Urgent" Watch "How to access a JSP Page-Urgent" New topic
Author

How to access a JSP Page-Urgent

Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
I am trying to access the JSP page from the browser which is under
CATALINA_HOME\webapps\IS_Project\jsp\welcome.jsp
through the
http://localhost:8080/IS_Project/jsp/welcome.jsp url , I am getting the following errors
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
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: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:324)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

Do I need to configure anything before I access a JSP page?
My Tomcat version is 4.1.12.
Archana
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Archana
The "Unable to compile class for JSP" included in your error output surely suggests that there is something out of place in your JSP file?
Can you post your code?
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Mark Thank you for the reply.
The file is just basic html code
<html>
<body>
Welcome Home
</body>
</html>
I really appreciate any help.
Archana
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Hmmm, strange. Works ok for me with Tomcat 4.0.4.
Have you looked at the generated servlet code? You are likely to find it under:
"CATALINA_HOME\work\Standalone\localhost\IS_Project\jsp\welcome$jsp.java"
Might provide some more clues...
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Mark this is the code I have in the work directory.
I am just not undertsanding where it is going wrong.
Does anybody had this problem before with 4.1.12.

package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class welcome_jsp extends HttpJspBase {

private static java.util.Vector _jspx_includes;
public java.util.List getIncludes() {
return _jspx_includes;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
javax.servlet.jsp.PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;

try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("<html>\r\n");
out.write("<body>\r\nWelcome Home\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (Throwable t) {
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Have you configured the Tomcat environment variables correctly?
CATALINA_HOME = <tomcat installation directory>
CLASSPATH = <tomcat installation directory>\common\lib\servlet.jar
JAVA_HOME = <java sdk installation directory>
[ March 09, 2003: Message edited by: mark howard ]
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Yes Mark I configured all the variables correctly.
May be I think I need to dig into this.
Right now I am really clue less.
Archana
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

what version of the jdk are you using? It should be 1.3.1 or above.
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
I am using SDk 1.4.1.
Archana
Sanka Bhatraju
Greenhorn

Joined: Feb 21, 2003
Posts: 3
Not sure if it is good to post in the same thread as the problem is similar...
I am trying to get my hello world program in JSP. I have started my tomcat and cannot get my JSP to show up. I have checked the path to be right.
The error that is displayed on the command window is
"
x.html + null) Connection aborted by peer: socket write error
2003-03-10 15:13:44 - Ctx( ): 404 R( + /myapps/welcome.jsp + null) JSP file no
t found
2003-03-10 15:37:53 - Ctx( ): 404 R( + /myapps/welcome.jsp + null) JSP file no
t found
2003-03-10 15:42:21 - Ctx( ): 404 R( + /myapps/welcome.jsp + null) JSP file no
t found
2003-03-10 15:42:30 - Ctx( ): 404 R( + /myapps/welcome.html + null) null
2003-03-10 15:42:56 - Ctx( ): 404 R( + /myapps/welcome.html + null) null"
Help??
[ March 10, 2003: Message edited by: Sanka Bhatraju ]
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Hey Mark , Mike I got it.
I need to have WEB-INF folder under my jsp files with an web.xml , I did create WEB-INF and web.mxl for servlets but not for JSP.After a long google search I found a good article which explained everything step by step and everything started working.
Thanks for all help.
Archana
Meena J
Greenhorn

Joined: Feb 21, 2003
Posts: 8
Hi Archana,
Could you give me the link of that article you found on google...I would be grateful to you.
Thanks.
Meena
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Hi,
This is the link for that article
http://www.sitepoint.com/article/305/1
Archana
Meena J
Greenhorn

Joined: Feb 21, 2003
Posts: 8
Hi Archana,
Thanks, I got the link, it's really a good link. Thank you once again.
Bye
Meena
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access a JSP Page-Urgent