Topic: 按斑竹的配置,第一个jsp,同样难产-问题解决了,是安装tomcat有点问题 |
Print this page |
1.按斑竹的配置,第一个jsp,同样难产-问题解决了,是安装tomcat有点问题 | Copy to clipboard |
Posted by: yingzhe Posted on: 2005-11-08 09:30 安装好jdk,配置后测试java程序没问题 安装好tomcat,配置后运行:htpp://localhost:8080,可以出现欢迎界面 tomcat自带的jsp-example运行正常。 建立自己的jsp app目录 1.到Tomcat的安装目录的webapps目录,可以看到ROOT,examples, tomcat-docs之类Tomcat自带的的目录; 2.在webapps目录下新建一个目录,起名叫myapp; 3.myapp下新建一个目录WEB-INF,注意,目录名称是区分大小写的; 4.WEB-INF下新建一个文件web.xml,内容如下: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>My Web Application</display-name> <description> A application for test. </description> </web-app> 5.在myapp下新建一个测试的jsp页面,文件名为index.jsp,文件内容如下: <html><body><center> Now time is: <%=new java.util.Date()%> </center></body></html> 6.重启Tomcat 7.打开浏览器,输入http://localhost:8080/myapp/index.jsp 出现一下错误: 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 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:439) org.apache.jasper.compiler.Compiler.compile(Compiler.java:497) org.apache.jasper.compiler.Compiler.compile(Compiler.java:476) org.apache.jasper.compiler.Compiler.compile(Compiler.java:464) 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_HOME does 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:407) org.apache.jasper.compiler.Compiler.compile(Compiler.java:497) org.apache.jasper.compiler.Compiler.compile(Compiler.java:476) org.apache.jasper.compiler.Compiler.compile(Compiler.java:464) 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.30 logs. 本站点关于tomcat配置的帖子我也都看了,可还是解决不了当前问题,不知道小弟有哪些发面没有注意到,请各位高手多多指教,不胜感激!! |
2.Re:按斑竹的配置,第一个jsp,同样难产 [Re: yingzhe] | Copy to clipboard |
Posted by: leowu2000 Posted on: 2005-11-08 13:33 安装tomcat之前,设置一下JAVA_HOME变量.have a try. |
3.Re:按斑竹的配置,第一个jsp,同样难产 [Re: yingzhe] | Copy to clipboard |
Posted by: yingzhe Posted on: 2005-11-08 23:55 设置了,环境变量里面path指向javac所在的目录,也就是E:\j2sdk1.4.2_05\bin 还是不行, 焦虑等待中 |
4.Re:按斑竹的配置,第一个jsp,同样难产 [Re: yingzhe] | Copy to clipboard |
Posted by: leowu2000 Posted on: 2005-11-09 00:48 记住是在“ 安装tomcat之前”。另外,补充一下,这个和path没有关系。 你可以卸载tomcat 然后重新安装,提示找到jre的时候,指定为JDK的目录。 |
5.Re:按斑竹的配置,第一个jsp,同样难产 [Re: yingzhe] | Copy to clipboard |
Posted by: chengbd Posted on: 2005-11-12 04:17 Unable to find a javac compiler; 把sun 的JDK中的那个tools.jar复制到tomcat的相关lib目录中试试 |
6.Re:按斑竹的配置,第一个jsp,同样难产 [Re: yingzhe] | Copy to clipboard |
Posted by: zhupan Posted on: 2005-11-12 15:17 汗 测试文件写的有点问题 改为下面的试下: <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>jsp测试</title> </head> <body><center> Now time is: <%=new java.util.Date()%> </center> </body> </html> |
7.Re:按斑竹的配置,第一个jsp,同样难产 [Re: yingzhe] | Copy to clipboard |
Posted by: yingzhe Posted on: 2005-11-16 12:12 问题解决了,还是安装tomcat的时候有点问题 我爱cjsdn |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |