Servlet:严重:为Servlet分配异常

以下堆栈跟踪是我尝试访问servlet时得到的信息,该servlet在Tomcat管理器中运行正常。

11 Sep, 2012 11:50:12 AM org.apache.catalina.core.ApplicationContext log

INFO: Marking servlet LoginServlet as unavailable

11 Sep, 2012 11:50:12 AM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Allocate exception for servlet LoginServlet

java.lang.Error: Unresolved compilation problems:

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

HttpServlet cannot be resolved to a type

ServletConfig cannot be resolved to a type

ServletException cannot be resolved to a type

HttpServlet cannot be resolved to a type

ServletContext cannot be resolved to a type

ServletException cannot be resolved to a type

HttpServletRequest cannot be resolved to a type

HttpServletResponse cannot be resolved to a type

ServletException cannot be resolved to a type

request cannot be resolved

The method getLoggedin() from the type LoginHandler refers to the missing type ServletException

The method destroy() of type LoginManager must override or implement a supertype method

HttpServlet cannot be resolved to a type

at com.login.servlets.LoginManager.<init>(LoginManager.java:5)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149)

at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)

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.Http11AprProcessor.process(Http11AprProcessor.java:877)

at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)

at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)

at java.lang.Thread.run(Unknown Source)

11 Sep, 2012 12:05:12 PM org.apache.catalina.core.ApplicationContext log

INFO: Marking servlet Log4JInitServlet as unavailable

11 Sep, 2012 12:05:12 PM org.apache.catalina.core.StandardContext loadOnStartup

SEVERE: Servlet /logintest threw load() exception

java.lang.Error: Unresolved compilation problems:

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

The import javax.servlet cannot be resolved

The import org.apache cannot be resolved

The import org.apache cannot be resolved

HttpServlet cannot be resolved to a type

ServletConfig cannot be resolved to a type

ServletException cannot be resolved to a type

ServletContext cannot be resolved to a type

BasicConfigurator cannot be resolved

PropertyConfigurator cannot be resolved

BasicConfigurator cannot be resolved

at com.logger.WebLogger.<init>(WebLogger.java:5)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)

at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3461)

at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:943)

at org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:557)

at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:121)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

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.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)

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.Http11AprProcessor.process(Http11AprProcessor.java:877)

at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)

at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)

at java.lang.Thread.run(Unknown Source)

在Eclipse类路径中使用的所有jar都可以在Tomcat

lib文件夹中找到。该webapp的部署没有任何错误日志,但是当我尝试访问一个servlet时,会发生此异常,并且我将其记录在tomcat日志中。有人能帮忙吗?

The package names are proper inside 'classes', also, the web.xml is proper.

我不知道为什么会这样。还有其他一些Web应用程序,它们几乎使用相同的库运行良好。期待有人可以帮助我。

谢谢

回答:

终于,弄错了。这是由Eclipse构建引起的问题。由于构建不正确,因此类文件已损坏。我清理了整个项目,重新构建,现在可以正常工作了。多谢您的回覆。

以上是 Servlet:严重:为Servlet分配异常 的全部内容, 来源链接: utcz.com/qa/436411.html

回到顶部