springboot jar包 jsp页面无法解析访问 There was an unexpected error

springboot 项目无法解析jsp问题会出现如图提示

There was an unexpected error 

 

springboot jar包 jsp页面无法解析访问 There was an unexpected error_第1张图片

具体原因是可能有很多种,但是尝试了很多解决方案之后发现罪魁祸首竟是打包工具的版本问题;

1.首先确定有没有依赖jsp整合jar包


    org.springframework.boot
    spring-boot-starter-tomcat


    org.apache.tomcat.embed
    tomcat-embed-jasper



    javax.servlet
    jstl

2.如果上面依赖完成基本都是打包问题了

  1.首先需要添加下面的配置使得生成jar包时 将jsp页面放在META-INF/resources目录下


    src/main/webapp
    
    META-INF/resources
    
        **/*.*
    

  2.上面配置完成后还需要最后一个配置,也是最关键的一个配置  spring-boot-maven-plugin插件版本必须是1.4.2.RELEASE版本

而且必须指定启动类,否则打包编译报错!


    org.springframework.boot
    spring-boot-maven-plugin
    
    1.4.2.RELEASE
    
        
        com.hkd.HkdApplication
    
    
        
            
                repackage
            
        
    

 

完成!!!

你可能感兴趣的:(springcloud)