日期:2014-05-18  浏览次数:20712 次

jsp在tomcat中配置运行的问题
我装的tomcat5.0.8,jdk运行正常编译java   /servlet都没问题

环境变量为
classpath=.;c:\jdk1.5.0_08\lib\dt.jar;c:\jdk1.5.0_08\lib\tools.jar;c:\jdk1.5.0_08\lib\servlet-api.jar;C:\Tomcat   5.0\common\lib\jsp-api.jar

要运行JSP程序,是个小的测试程序,我把它拷到   webapp\myjsp\test.jsp

在tomcat中运行,得到

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:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
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:106)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
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)


我看到tomcat   自带的jsp程序在WEB-INF\web.xml中有指定jsp的class,如   index.jsp  

<servlet>
                <servlet-name> org.apache.jsp.index_jsp </servlet-name>
                <servlet-class> org.apache.jsp.index_jsp </servlet-class>
        </servlet>

        <servlet-mapping>
                <servlet-name> org.apache.jsp.index_jsp </servlet-name>
                <url-pattern> /index.jsp </url-pattern>

是不是我也要写一个servlet-class,我的目的就是让我的小小的jsp在tomcat中正常运行起来,请问如何做呢,望各位不赐吝教!谢谢!



------