栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

信创环境下部署SpringBootAdmin监控服务遇到的问题

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

信创环境下部署SpringBootAdmin监控服务遇到的问题

背景

就像通常的微服务打包部署至国产化环境中一样,先是做了以下操作:

  • 排除默认的Tomcat
  • 打war包
  • 重写启动类

可是 war 打包时报错:

  1. 找不到javax.servlet.Filter的类文件;
  2. Description:The Bean Validation API is on the classpath but no implementation could be found; Action:Add an implementation, such as Hibernate Validator, to the classpath
排除默认的Tomcat


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

打war包
war

    
        ${project.artifactId}
        
            
                maven-war-plugin
                2.6
                
                    
                    false
                
            
        
    
重写启动类

重写启动类,继承 SpringBootServletInitializer 类,重写 configure 方法,否则无法检测到启动类。

public class StandardMonitorApplication extends SpringBootServletInitializer
{
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    return builder.sources(StandardMonitorApplication.class);
    }

    public static void main(String[] args)
    {
        SpringApplication.run(StandardMonitorApplication.class, args);
        System.out.println("(♥◠‿◠)ノ゙  系统模块启动成功   ლ(´ڡ`ლ)゙  ");
    }
}

解决错误1:

由于使用TongWeb,在 pom 文件中排除了 Tomcat ,代码中用到了WebSecurityConfigurerAdapter,打包报错:找不到 javax.servlet.Filter 的类文件

  • 添加依赖:javaee-api
        
            javax
            javaee-api
            7.0
        
解决错误2:

Description:
The Bean Validation API is on the classpath but no implementation could be found
Action:
Add an implementation, such as Hibernate Validator, to the classpath

  • 添加依赖:hibernate-validator
        
            org.hibernate
            hibernate-validator
            5.2.4.Final
        

If you have any questions or any bugs are found, please feel free to contact me.

Your comments and suggestions are welcome!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1003964.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号