org.apache.jasper.jasperexception无法为jsp编译类

时间:2014-02-26 11:35:22

标签: java

当我运行我的jsp文件时出现此错误,请帮助我找出这个。

HTTP Status 500 - Unable to compile class for JSP:

type Exception report

message Unable to compile class for JSP:

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: 619 in the jsp file: /bbb_api.jsp
The type Date is ambiguous
616:                String starttime = recording.getElementsByTagName("startTime").item(0).getTextContent();
617:                try{
618:                    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
619:                    Date resultdate = new Date(Long.parseLong(starttime));
620:                    starttime = sdf.format(resultdate);
621:                }catch(Exception e){
622: 

Stacktrace:
                                                                                        org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:443)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.37 logs.
Apache Tomcat/6.0.37                    

2 个答案:

答案 0 :(得分:1)

从该JSP的页面导入中的jva.util.Date导入日期

<%@page import="java.util.Date" %>

或使用

Date类的完全限定名称,如java.util.Date

 java.util.Date resultdate = new java.util.Date(Long.parseLong(starttime));

sql包Date和util Date class之间的不一致

答案 1 :(得分:0)

我认为你导入了java.util.Date和javax.sql.Date。

尝试从import语句中删除javax.sql.Date。