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

最近项目完成后打包成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,请问该如何解决呢?

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/421405.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux 命令行模式下,浏览网页方法

Ubuntu自带最新版的Gnome桌面,拥有大量的服务和桌面应用程序,让您仅通过一张安装光盘就可以体验到无比舒适的操作环境。下文介绍的在ubuntu下使用终端命令行上网的方法。 第一步,需要安装一个名为w3m的软件工具,打开终端&#xff…

数组的增删

public class A {public static void main(String[] args) {int[] arr { 1, 2, 5, 23, 64, 9, 87, 99 };// 要求删除23int index -1;int num 23;for (int i 0; i < arr.length; i) {if (num arr[i]) {index i;}}for (int i index 1; i < arr.length; i) {arr[i -…

linux就业技术指导,学linux前景怎么样

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼青海华夏职业学校09年招生简章221.207.32.* 1楼青海华夏职业技术中等专科学校概况&#xff1a;青海华夏职业技术中等专科学校是由青海省教育厅备案并批准成立的一所中等层次的职业技术专修学校。学校坐落在青海省西宁市美丽的南川河…

获取Android版本信息和电话信息

Android的版本信息可以通过android.os.Build获得&#xff0c;电话信息可以通过TelephonyManager获得&#xff0c;代码如下&#xff1a; private void get_infor(){sdk android.os.Build.VERSION.SDK;;release android.os.Build.VERSION.RELEASE;user android.os.Build.USER;…

简单的二维数组

/*找人,找到输出在第几楼第几号房间&#xff08;考虑没有找到的情况&#xff09;*/ /*{{"凤姐","蔡除坤","张洁"},{"姚鸣","芙蓉姐姐"},{"马尔克死","打仲马","肝塞特","高死你"}}…

求e的c语言程序,(C语言)计算e的x次方

计算e的x次方题目&#xff1a;编写程序&#xff0c;计算ex1x(x2)/(2!)(x3)/(3!)(x4)/(4!)…(x^n)/n!说明&#xff1a;e^x表示e的x次方&#xff0c;2!表示2的阶乘输入输出格式要求&#xff1a;输入格式&#xff1a;x n回车e^x, x, n均用double类型存储。要求输出小数点后6位。只…

第一次接触万物接对象

public class Girl{//一个类文件String name;//开始赋予girl的静态属性String character;String ilike;String range;public void introduction(){//方法&#xff0c;无参无返&#xff0c;动态属性System.out.print("Name&#xff1a;"name"\n"""…

用c语言程序编写一份试卷,C语言程序设计试题

C语言程序设计试题俗话说&#xff1a;“一份耕耘&#xff0c;一分收获。”耕耘就得付出一定的代价&#xff0c;没有那含辛如苦的“耕耘”&#xff0c;哪能领会到甜人心田的收获?以下是小编为大家搜索整理的C语言程序设计试题&#xff0c;希望能给大家带来帮助!更多精彩内容请及…

[课程相关]homework-06

一、c11 lambda /* * File: main.cpp* Author: liangjie** Created on 2013年11月23日, 下午12:02*/#include <cstdlib> #include <iostream>using namespace std;/** */ int main(int argc, char** argv) {string aa "Hello World!";int b 0, c 0;…

面向对象封装之无参无返,无参有返

public class E{public static void main(String[]args){EQ enew EQ();e.name"Mr.Deng";e.age29;e.weight50.5;e.hobby"Designing something that he like";e.jieShao();String be.sentPresence();//对象接受返回值System.out.println("Thats "b…

IOS6 新特性之UIRefreshControl

“不会模仿的公司不是好公司不会剽窃的公司不是优秀公司 不会调戏代码的不是骨灰级码工 你同意吗&#xff1f; 苹果估计想取代第三方的pull to refresh” --------------以上摘自DevDiv社区 源代码参考了DevDiv社区的代码 地址&#xff1a;http://www.devdiv.com/iOS_iP…

c语言 计算坐标,求助,有关坐标计算的

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼#include "stdafx.h"#include#include#include#include#define PI 3.14159265358979using namespace std;void main(){double point[100][3];char name[100][1];int i;FILE *fpfopen("D:\\作业\\大地坐标.txt"…

java面向对象封装之有参无返与有参有返

public class A{public static void main(String []args){B bnew B();b.show(99);String ab.show1(90,100);//方法show1返回字符串类型的值&&对象//90&#xff0c;100为参数&#xff0c;对象b给方法的值 System.out.println(a);}}class B{ //有参无返public void show…

终端模拟器编译c语言,编写你自己的Terminal emulator

安装开发依赖环境在apt包管理器系中&#xff0c;使用以下命令安装apt install libvte-2.91-dev介绍VTE是一个使用GTK构建的一个终端模拟器库&#xff0c; 能够处理DPI的更改。很多终端模拟器软件都基于VTE库&#xff0c;包括GNOME Terminal&#xff0c; XFCE Terminal&#xff…

转:Ubuntu下下载工具安装--uget+aria2

原文地址&#xff1a;http://burner1024.blog.163.com/blog/static/17447800420126191858424/ Windows下的下载工具--迅雷&#xff0c;之所以下载速度快&#xff0c;乃是它能搜索资源、为己所用&#xff0c;而不是仅仅从原始地址这单一资源处下载。Ubuntu下也有类似的工具&…

面向对象之编写一个完整的类

package com.work.cast;public class People {public static void main(String[] args) {People1 pnew People1();p.setName("李白");p.setAge(55);p.setSex(男);p.setHeight(183.5);//p.toString();System.out.println(p);}} class People1{//name age sex heightpr…

c语言写程序轮询是什么意思,单片机轮询按键程序

#include #define uchar unsigned char//按键端口定义sbit io_key_1 P2^0 ;sbit io_key_2 P2^1 ;sbit io_key_3 P2^2 ;sbit io_key_4 P2^3 ;sbit P30 P3^0;sbit P31 P3^1;sbit P32 P3^2;sbit P33 P3^3;//定义长按键的TICK数,以及连_发间隔的TICK数#define KEY_LONG_PER…