送分!初级问题,tomcat报错。(50分)

  • 主题发起人 主题发起人 zky88
  • 开始时间 开始时间
Z

zky88

Unregistered / Unconfirmed
GUEST, unregistred user!
http://127.0.0.1:8080/jsp-examples/num/numguess.jsp可以正常打开页面,
http://127.0.0.1:8080/jsp-examples/num/123.jsp时tomcat报错,
我的123.jsp:
<%@ page contentType=&quot;text/html;
charset=gb2312&quot;
language=&quot;java&quot;
import=&quot;java.sql.*&quot;
errorPage=&quot;&quot;
%>
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>
<html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;>
<head>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=gb2312&quot;
/>
<title>无标题文档</title>
</head>
<body>
Hello! The time is now <%= new java.util.Date() %>
</body>
</html>
我跟 numguess.jsp放在相同目录的,123.jsp就不行,报错如下:
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
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:434)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:492)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOMEdo
es not point to the JDK
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:929)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:402)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:492)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.29 logs.
 
1、你的123.jsp可能编码有问题
2、把你的tomcat安装目录中的work中的文档删除,清空tomcat的缓存看看
 
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOMEdo
es not point to the JDK
看这句好像是jdk没配置好,网上关于jdk和tomcat配置很多,照着做应该没有问题
 
同意楼上。
 
同意楼上,你在123上调用了java.util.Date() ,你把这个函数去了。
刚学jsp没超过24hour
 
你用 java.util.Date()
但是没有 import=&quot;java.sql.*&quot;
进来,当然会错
 
同意楼上
 
我要学java
 
多人接受答案了。
 
后退
顶部