最近项目完成后打包成war发布到服务器遇到访问应用404问题,用的是tomcat8.5,错误信息如下:

o.s.b.w.servlet.support.ErrorPageFilter  : Cannot forward to error page for request [/login] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false

项目是springboot+security+mybatis,ide 用的idea,打包方式用的是build菜单中的Build Artifactis

security配置protected void configure(HttpSecurity http) throws Exception {

http.authorizeRequests()

//处理preflight请求

//.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()

.antMatchers("/user/login").permitAll()

.antMatchers("/login").permitAll()

.antMatchers("/login/error").permitAll()

.anyRequest().authenticated()

.and()

//设置登录页

.formLogin()

//设置登录成功页

.loginPage("/login")

.successHandler(securityLoginSuccessHandler)

.failureHandler(securityLoginFailureHandler)

.and()

.logout()

.logoutUrl("/logout")

.logoutSuccessHandler(securityLogoutSuccessHandler)

.deleteCookies("JSESSIONID")

.and()

.sessionManagement()

//session超时处理

.invalidSessionUrl("/login/invalid")

.maximumSessions(1)

//老用户被踢出后操作

.expiredSessionStrategy(new SecurityExpiredSessionStrategy());

http.csrf().disable()

.exceptionHandling().accessDeniedHandler(securityAccessDeniedHandler);

}

loginpage的“/login”配置如下:@RequestMapping("/login")

public String  showLogin() throws IOException {

System.out.println("调用loginController的登录方法");

return "index.html#/login";

}

这篇博客在启动类加入配置:public class KpApplication extends SpringBootServletInitializer {

public static void main(String[] args) {

SpringApplication.run(KpApplication.class, args);

}

@Bean

public ErrorPageFilter errorPageFilter() {

return new ErrorPageFilter();

}

@Bean

public FilterRegistrationBean disableSpringBootErrorFilter(ErrorPageFilter filter) {

FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();

filterRegistrationBean.setFilter(filter);

filterRegistrationBean.setEnabled(false);

return filterRegistrationBean;

}

}

重新打包发布到linux服务器,新的错误信息为:

o.s.b.d.LoggingFailureAnalysisReporter   :

***************************

APPLICATION FAILED TO START

***************************

Description:

The bean 'errorPageFilter', defined in org.springframework.boot.web.servlet.support.ErrorPageFilterConfiguration, could not be registered. A bean with that name has already been defined in com.kpzdh.kp.KpApplication and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=truespring:

jmx:

default-domain: demo

datasource:

driver-class-name: com.mysql.cj.jdbc.Driver

url: jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8

username: root

password: root

main:

allow-bean-definition-overriding: true

如上配置之后,两个错误信息都没有出现了,但是还是404,查看日志,"/login"路径的"调用loginController的登录方法"已经输出了,

但是浏览器控制台中,/login路径还是404,请问该如何解决呢?

这个问题已经困扰很久了,希望大家能帮帮我,万分感谢!

window的war发布Linux失败,为什么war包在Windows的tomcat正常运行,在linux服务器报errorpage错误?...相关推荐

  1. 使用idea打包war包和maven项目打包war包放到tomcat中运行,以及报404错误的解决

    使用idea打包war包和maven项目打包war包放到tomcat中运行,以及报404错误的解决 在tomcat下运行打包的war包,访问时显示404 浅谈打包war包的方式 第一种: 第一步: 第 ...

  2. linux创建新用户,以及windows通过xrdp远程登录Linux

    主要内容 一.linux创建新用户 1.打开终端 2.创建用户和密码 3.设置给予的权限 4.设置命令解释器 二.windows通过xrdp远程登录Linux 参考内容来源 一.linux创建新用户 ...

  3. linux内核之旅ppt_微软Windows 10防病毒现已可用Linux上

    微软在推出预览版应用程序几个月后,刚刚宣布了适用于Linux的Microsoft Defender ATP的全面可用性. " Microsoft Defender ATP将Linux添加到现 ...

  4. linux开启rdp服务,让windows电脑mstsc远程,linux rdesktop远程windows机器

    windows 远程 linux桌面系统 windows7, CentOS release 6.9 1.安装 yum install xrdp 2.启动服务 service xrdp start 3. ...

  5. linux系统启动项没了,重装Windows后找回丢失的Linux启动项

    众所周知,安装Windows和linux双系统的时候最好是先装Windows,然后安装linux.因为linux可以寻找硬盘下的Windows系统,从而显示引导菜单.而霸道的Windows直接无视其他 ...

  6. linux安装jenkins启动卡在初始页面 | 插件下载不了,报SSL错误等问题避坑 | No valid crumb was included in request for /ajaxBuildQ

    我在安装中遇到的问题,分享一下,但愿有帮助 1.安装完成后边登录一直卡在初始页面进不去: 修改/var/lib/jenkins下的 hudson.model.UpdateCenter.xml 文件 将 ...

  7. linux 网卡只收到包不发包,【干货分享】Linux虚拟机网卡只能收包不能发包?

    [干货分享]Linux虚拟机网卡只能收包不能发包?: U1 d; M2 ~  ]7 Q: J5 M- v# J3 @ * v; Y  P1 Q$ ]: I' T8 z在ovs场景主机与同主机上的虚拟机 ...

  8. 一键装linux系统安装,有什么可以在windows下一键安装的linux系统

    解决方法很简单, 只要删除c:\g1ldr[color=#DC143C]文件就OK了; 但是一般人是找不到这个文件的,因为它是受保护的操作系统文件, 默认是隐藏的,所以一般是在C盘是看不到的, 如何去 ...

  9. Windows和Linux双启动,并用在Windows下配置CoLinux启动

    http://www.cppblog.com/newclear/archive/2009/09/27/97327.html Windows和Linux双启动,并用在Windows下配置CoLinux启 ...

最新文章

  1. 子图同构问题与Ullmann Algorithm 算法(一)
  2. 实用技巧:教你如何在没有网络的Linux机器上快速安装软件
  3. flash数字时钟_数字电路设计在嵌入式中的应用
  4. 【资源推荐】良心之作!超过 10000+ 的互联网团队正在使用的在线 API 文档、技术文档工具...
  5. oracle rownum 特别慢,select * from table where rownum=1怎么会特别慢??表的数据在千万左右...
  6. mask属性是css3的吗_使用CSS3 mask(蒙版,遮罩)属性实现超酷按钮悬停动画
  7. python 在线预览文件_用Python PyQt写一个在线预览图片的GUI
  8. ACM基础——OJ上的Java代码提交规范
  9. Spring内建可查找的依赖
  10. io里没有driveinfo没有_来福宝宝,愿天堂里没有病痛
  11. FM1288的AEC调试经历,持续更新
  12. 免费WiFi初体验——个小白的WiFi旅程
  13. MATLAB求解三角函数
  14. 【深入理解CSS】层叠、优先级、继承
  15. java如何创建长连接_Java如何实现长连接
  16. script脚本阻塞的探究、异步属性async和defer的区别
  17. 【华为MateBook13】更换1TB固态硬盘SSD+重装win10系统+安装NVIDIA显卡驱动+电脑管家+指纹驱动+蓝牙驱动+Office激活
  18. mysql 表情符_java+mysql对于表情符的处理
  19. 手把手教你用Arcgis绘制地图【热力图】
  20. 2019年信息安全工程师上午真题及答案解析

热门文章

  1. 前端学习(542):node得环境搭建
  2. 前端学习(64):css继承属性小结
  3. git学习(8):windows系统下VI编辑器的基本使用
  4. 华农计算机学院院长,华农大生命科学技术学院副院长到武生院任职
  5. mysql ndb 关闭_Mysql NDB 常见问题
  6. A Quantization-Friendly Separable Convolution for MobileNets
  7. 是什么东西_隐形牙套附件是什么东西?
  8. mysql 写入慢_MySQL主从,你遇到过哪些问题?
  9. 《CLR via C#》 第三版的主要内容
  10. 关于webservice(CXF)的一些理解