• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error 500

 
sachin cknd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a problem in JSP.
my html page is as follows :
******** index1.html
<html><body>
<form action="http://127.0.0.1:8080/examples/jsp/demo/name.jsp" method="post" >
<input type=text name=t1>
<input type=submit>
</form>
</body></html>
**********************
My jsp page is as follows :
******** name.jsp
<html><body>
Your Name is <%= request.getParameter("t1")
System.out.println("Hello");
%>
</body></html>

**********************
Its a simple and straight forward code but i am getting error as
************** Error :
Error: 500
Location: /examples/jsp/demo/name.jsp
Internal Servlet Error:
javax.servlet.ServletException: sun/tools/javac/Main
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java, Compiled Code)
at java.lang.Thread.run(Thread.java:479)
Root cause:
java.lang.NoClassDefFoundError: sun/tools/javac/Main
at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:128)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled Code)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:152)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:164)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java, Compiled Code)
at java.lang.Thread.run(Thread.java:479)
*********************

i am using TOMCAT Version 3.2.1
i am very new to jsp and not getting out of the blues.
can anybody help me ?

thank you in advance.
sachin
 
shailesh sonavadekar
Ranch Hand
Posts: 1874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
welcome to javaranch , Sachin
PROPER NAMES ARE NOW REQUIRED

Sachin , Please refer to official naming policy of Javaranch. You have to reregister yourself with proper first & last name. I think cknd is not your last name. Sp , please comply with the naming policy of javaranch & help maintain the decorum of the forum.

your firendly bartender
Shailesh
 
Ryan Yeap
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the exact same problem ...
 
Wayne Hefner
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This happens because this project requires the java compiler to be present in your classpath, so, if you have Java 1.2.x, you have to set the tools.jar package you find in [jdk_home]/lib/tools.jar in your classpath (either system classpath or your servlet engine's classpath).

 
Rehan Malik
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Switch your name.jsp file to the following:
<html><body>
Your Name is <% request.getParameter("t1");
System.out.println("Hello"); %>
</body></html>
Notice that when you're using the <%=, you MUST make sure there's going to be only one line there otherwise, it will bomb out on you. At least, that's what my experience has shown. If you're going to be using multiple line jsp scriplets, then use what I've provided.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic