第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么war包在Windows的tomcat正常運行,在linux服務器報errorpage錯誤?

為什么war包在Windows的tomcat正常運行,在linux服務器報errorpage錯誤?

木子錦 2019-08-19 10:55:11
最近項目完成后打包成war發(fā)布到服務器遇到訪問應用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 Artifactissecurity配置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("調(diào)用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; ????} } 重新打包發(fā)布到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=true然后在yml配置中加入配置:spring: ??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 ???? 如上配置之后,兩個錯誤信息都沒有出現(xiàn)了,但是還是404,查看日志,"/login"路徑的"調(diào)用loginController的登錄方法"已經(jīng)輸出了, 但是瀏覽器控制臺中,/login路徑還是404,請問該如何解決呢?這個問題已經(jīng)困擾很久了,希望大家能幫幫我,萬分感謝!
查看完整描述
  • 3 回答
  • 0 關注
  • 4620 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號