gpt4 book ai didi

spring - Tomcat 服务器遇到 404 原因不明

转载 作者:行者123 更新时间:2023-11-28 23:20:44 25 4
gpt4 key购买 nike

我正在尝试使用 Maven 作为服务器在 Tomcat 8 上运行。我是这两个的新手,所以我有一个我还没有制作的示例文件,应该打印“欢迎”。但是,我收到此错误

The requested resource is not available.

我在我的 IDE (Netbeans) 上检查了 TomCat 日志,我发现它给出了这个错误:

org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext 26-May-2017 19:22:50.151 INFO [http-nio-8080-exec-76] org.apache.catalina.core.ApplicationContext.log Marking servlet court as unavailable 26-May-2017 19:22:50.151 SEVERE [http-nio-8080-exec-76] org.apache.catalina.core.StandardContext.loadOnStartup Servlet [court] in web application [/ronak] threw load() exception java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:509) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:490) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1027) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5038) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5348) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:461) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1612) at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1451) at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:897) at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:335) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) 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.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108) 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:94) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:616) 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:620) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489) 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)

我的问题是,我用粗体显示的行表示我的项目中没有这个存储库 :org.springframework.web.servlet.DispatcherServlet。但是,我确定它可以在我的依赖项中看到。文件 spring-webmvc.4.3.8.Release.jar 在预期的文件夹(WEB-INF/lib)中可见,它包含一个名为 DispatcherServlet.class 的类文件可以在我的 netbeans 项目窗口中访问。

我还检查了 POM 文件,我有这些声明这个文件和其他两个 spring web jar 文件作为依赖项:

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.8.RELEASE</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<!-- Set this to the respective version -->
<version>4.3.8.RELEASE</version>
<scope>provided</scope>
<type>jar</type>
</dependency>

那么,我在这里做错了什么吗?由于 TomCat 没有提供任何进一步的信息来准确说明找不到的内容,因此我看到的唯一问题就是这个。

提前致谢:)

最佳答案

您可以检查您的 Artifact ( war )中是否有库。如果 pom.xml 配置不正确,可能会缺少一些库。

关于spring - Tomcat 服务器遇到 404 原因不明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44205041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com