HTTP状态500错误

时间:2012-11-17 11:24:19

标签: java tomcat jsp-tags

我收到的错误就像

org.apache.jasper.JasperException: Unable to compile class for JSP: 
An error occurred at line: 6 in the generated java file
Only a type can be imported. com.sixpanview.getcoordinate resolves to a package
An error occurred at line: 7 in the generated java file
Only a type can be imported. com.sixpanview.fileReader resolves to a package
An error occurred at line: 8 in the generated java file
Only a type can be imported. com.sixpanview.cookieInfo resolves to a package

并且在.jsp程序中使用getcoordinatefileReadercookieInfo以及堆栈跟踪的行中出现错误

at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
        at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
        at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:679)

为什么我得到它?

1 个答案:

答案 0 :(得分:1)

您无法导入package。您需要在该包中导入classes

在导入语句中,将导入替换为: -

com.sixpanview.getcoordinate.*;
com.sixpanview.fileReader.*;
com.sixpanview.cookieInfo.*;

我认为这些软件包下没有其他子软件包。

.*将导入该包下的所有类。理想情况下,你不应该这样做。如果你知道它们是什么,那么import来自这些包的特定类。

喜欢: -

import java.util.List; 

优于: -

import java.util.*;

P.S:请不要在您的内容中使用bold case,除非突出显示非常重要。它难以阅读。并且在发布例外情况时,也会在将来发布您的代码段。