简体   繁体   中英

HTTP Status 500 error

I'm getting the error like

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

and getting errors at the lines which uses getcoordinate , fileReader and cookieInfo in the .jsp program and the stack trace is

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)

Why am i getting it?

You cannot import a package . You need to import classes inside that package.

In your import statement, replace your imports with: -

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

I assume there is not other sub-package under those packages.

.* will import all the classes under that package. Ideally, you should not do that. Rather import a specific class from those package if you know what are they.

Like: -

import java.util.List; 

is better than: -

import java.util.*;

PS : - Please don't use bold case in your content, unless it is really really important to be highlighted. Its difficult to read. And also post your code snippet in future, while posting exceptions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM