spring boot项目打成war包并且部署访问时该网页无法正常运作

项目启动时不报错,就是无法访问
访问时出现此情况

访问的时候服务器也没有日志,我打的是war包,详情看代码

POM.XML

 <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>8.0.39</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <!-- 去除内嵌tomcat-->
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
 @EnableTransactionManagement
@SpringBootApplication
@MapperScan("com.vrqzd.dao")
public class VrqzdApplication  extends SpringBootServletInitializer implements CommandLineRunner {
    private final static Logger logger = LoggerFactory.getLogger(VrqzdApplication.class);

    public static void main(String[] args) {
        SpringApplication.run(VrqzdApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        logger.info("主程序启动----------------->>启动完毕");
    }
}

 @EnableTransactionManagement
@SpringBootApplication
@MapperScan("com.vrqzd.dao")
public class SpringBootStartApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注意这里要指向原先用main方法执行的Application启动类
        return builder.sources(VrqzdApplication.class);
    }

}

     /**
     * 登录页面载入
     * @param response
     * @return
     */
    @RequestMapping(value ="login",method = RequestMethod.GET)
    public String login(HttpServletResponse response, HttpSession session, HttpServletRequest request){
     //   return "page/login";
        logger.info("==============登录发起==========");
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        if (session.getAttribute("ret")!=null){
            request.setAttribute("ret", session.getAttribute("ret"));
            session.removeAttribute("ret");
        }
        if(auth instanceof AnonymousAuthenticationToken){
            return "page/login";
        }else{
            return "redirect:/user";
        }
    }

发起这个登录的时候后台没有任何日志,就给我一个该网页无法正常运作,

查看全部
qq_24977097
VRTOW-GGD
2018/09/26 05:53
  • spring
  • java
  • tomcat
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

5个回复