Spring 部署Tomcat 404 错误解决方案

简介:

将Spring项目部署到tomcat后,访问网页出现404错误

HTTP Status 404 – Not Found The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

 

1. 查看tomcat下的log文件

1
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file 

 

在WEB-INF/classes下创建logging.properties文件

1
2
org.apache.catalina.core.ContainerBase.[Catalina].level=INFO
org.apache.catalina.core.ContainerBase[Catalina].handlers=java.util.logging.ConsoleHandler

 重启tomcat,之后就能看到全部错误log。

2.详细错误

1
org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file

 解决方法

1
2
3
4
5
Open the project's properties (e.g., right-click on the project's name in the project explorer and select "Properties").
Select "Deployment Assembly".
Click the "Add..." button on the right margin.
Select "Java Build Path Entries" from the menu of Directive Type and click "Next".
Select "Maven Dependencies" from the Java Build Path Entries menu and click "Finish".

  参考:http://stackoverflow.com/questions/6210757/java-lang-classnotfoundexception-org-springframework-web-context-contextloaderl

 


本文转自Work Hard Work Smart博客园博客,原文链接:http://www.cnblogs.com/linlf03/p/6627580.html,如需转载请自行联系原作者

目录
相关文章
|
21天前
|
人工智能 Java Spring
Spring Boot循环依赖的症状和解决方案
Spring Boot循环依赖的症状和解决方案
|
21天前
|
XML Java 应用服务中间件
Tomcat_servlet部署、编译、配置、打包
Tomcat_servlet部署、编译、配置、打包
29 0
|
12天前
|
Java 应用服务中间件 Apache
Tomcat的基本使用,如何用Maven创建Web项目、开发完成部署的Web项目
Tomcat的基本使用,如何用Maven创建Web项目、开发完成部署的Web项目
29 1
|
13天前
|
Java 关系型数据库 Docker
docker打包部署spring boot应用(mysql+jar+Nginx)
docker打包部署spring boot应用(mysql+jar+Nginx)
|
14天前
|
Java Maven Docker
Docker化Spring Boot3应用:从镜像构建到部署
本文介绍了如何在Linux上通过命令行构建和运行Spring Boot 3服务的Docker镜像。首先,基于Ubuntu创建包含JDK 21的基础镜像,然后使用Maven打包Spring Boot应用。接着,构建服务镜像,将应用和依赖添加到镜像中,并设置工作目录和暴露端口。最后,利用docker-compose部署服务,挂载宿主机目录以方便更新静态文件。Docker简化了应用部署,确保了不同环境的一致性。
77 2
Docker化Spring Boot3应用:从镜像构建到部署
|
16天前
|
JSON 安全 前端开发
跨域详解及Spring Boot 3中的跨域解决方案
本文介绍了Web开发中的跨域问题,包括概念、原因、影响以及在Spring Boot 3中的解决方案。跨域是由浏览器的同源策略限制引起的,阻碍了不同源之间的数据传输。解决方法包括CORS、JSONP和代理服务器。在Spring Boot 3中,可以通过配置CorsFilter来允许跨域请求,实现前后端分离项目的正常运行。
69 3
 跨域详解及Spring Boot 3中的跨域解决方案
|
21天前
|
应用服务中间件
jeecgboot开发环境服务启动刷新没问题,部署到tomcat,F5刷新或者浏览器刷新,会出现404
jeecgboot开发环境服务启动刷新没问题,部署到tomcat,F5刷新或者浏览器刷新,会出现404
12 0
|
21天前
|
安全 Java Docker
|
21天前
|
存储 Java 应用服务中间件
Springboot项目打war包部署到外置tomcat容器【详解版】
该文介绍了将Spring Boot应用改为war包并在外部Tomcat中部署的步骤:1) 修改pom.xml打包方式为war;2) 排除内置Tomcat依赖;3) 创建`ServletInitializer`类继承`SpringBootServletInitializer`;4) build部分需指定`finalName`;5) 使用`mvn clean package`打包,将war包放入外部Tomcat的webapps目录,通过startup脚本启动Tomcat并访问应用。注意,应用访问路径和静态资源引用需包含war包名。
|
21天前
|
Dubbo Java 应用服务中间件
Spring Cloud Dubbo: 微服务通信的高效解决方案
【4月更文挑战第28天】在微服务架构的发展中,服务间的高效通信至关重要。Spring Cloud Dubbo 提供了一种基于 RPC 的通信方式,使得服务间的调用就像本地方法调用一样简单。本篇博客将探讨 Spring Cloud Dubbo 的核心概念,并通过具体实例展示其在项目中的实战应用。
25 2