简体   繁体   English

eclipse,maven,tomcat:http状态500无法编译

[英]eclipse, maven, tomcat: http status 500 unable to compile

So I know that there are a lot of other questions that have been asked on nearly the same thing, but I have not been able to fix my problem with the information provided in them. 因此,我知道关于同一件事,还有很多其他问题要问,但是我无法使用其中提供的信息解决我的问题。

I have a maven project in eclipse that gives this error when it tries to redirect me to my program processForm.jsp, after pressing submit on my .jsp form. 我在Eclipse中有一个Maven项目,在按.jsp表单上的Submit之后,尝试将我重定向到程序processForm.jsp时,出现此错误。 It seems to have an issue with importing the class I created called parseForm. 导入我创建的名为parseForm的类似乎有问题。

Here are snippets of processForm.jsp where the errors take place and where I import according to the stack trace: 这是processForm.jsp的片段,其中发生错误,并根据堆栈跟踪导入:

Import statements: 导入语句:

 <!-- java import statements -->
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="myPackage.ParseForm" %>

Spot of error: 错误点:

//implement ParseForm.java
ParseForm pf = new ParseForm(f);
System.out.println(pf.getInfo());
%>

Here is a screenshot of the error message given in tomcat: part 1 part 2 这是tomcat中给出的错误消息的屏幕截图: 第1 部分第2部分

Here is the full error message given in the console: 这是控制台中给出的完整错误消息:

An error occurred at line: [16] in the generated java file: [/Users/speedofast4749/Documents/Eclipse Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/ARForm/org/apache/jsp/processForm_jsp.java]
Only a type can be imported. myPackage.ParseForm resolves to a package

An error occurred at line: 58 in the jsp file: /processForm.jsp
ParseForm cannot be resolved to a type
55: }
56: 
57: //implement ParseForm.java
58: ParseForm pf = new ParseForm(f);
59: System.out.println(pf.getInfo());
60: %>
61: 


An error occurred at line: 58 in the jsp file: /processForm.jsp
ParseForm cannot be resolved to a type
55: }
56: 
57: //implement ParseForm.java
58: ParseForm pf = new ParseForm(f);
59: System.out.println(pf.getInfo());
60: %>
61: 


Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [16] in the generated java file: [/Users/speedofast4749/Documents/Eclipse Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/ARForm/org/apache/jsp/processForm_jsp.java]
Only a type can be imported. myPackage.ParseForm resolves to a package

An error occurred at line: 58 in the jsp file: /processForm.jsp
ParseForm cannot be resolved to a type
55: }
56: 
57: //implement ParseForm.java
58: ParseForm pf = new ParseForm(f);
59: System.out.println(pf.getInfo());
60: %>
61: 


An error occurred at line: 58 in the jsp file: /processForm.jsp
ParseForm cannot be resolved to a type
55: }
56: 
57: //implement ParseForm.java
58: ParseForm pf = new ParseForm(f);
59: System.out.println(pf.getInfo());
60: %>
61: 


Stacktrace:
    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:198)
    at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

Thank you in advance! 先感谢您!

UPDATE: At some point in trying to solve this problem, I'm not exactly sure when, the error message changed to HTTP Status 500 - An exception occurred processing JSP page /processForm.jsp at line 58 更新:在试图解决此问题的某个时刻,我不确定何时将错误消息更改为HTTP Status 500 - An exception occurred processing JSP page /processForm.jsp at line 58

add a semicolon at the end of last import statement. 在最后一个import语句的末尾添加分号。

<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="myPackage.ParseForm"; %>

OK so this is going to sound really weird but I've been continuing to play around with my programs and at some point I made a change that I don't even know which fixed it, because now it works! 好的,这听起来确实很奇怪,但是我一直在继续尝试我的程序,有时我做了一个更改,我什至不知道是哪个修复了它,因为现在可以了! Really strange but I guess you can't complain about a working program. 真的很奇怪,但是我想您不能抱怨一个正在运行的程序。 I read over my code like 4 times now and still can't find what is different than before so I don't even know what to think :( Thanks for all the help everyone! :) 我现在大约四遍阅读我的代码,但仍然找不到以前的区别,所以我什至不知道该怎么想:(谢谢大家的所有帮助!:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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