栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

SpringBoot+Dubbo+Zookeeper所遇到的坑

SpringBoot+Dubbo+Zookeeper所遇到的坑

目录

前言:

坑一:LoggerFactory is not a Logback LoggerContext but Logback is on the classpath

 坑二:An attempt was made to call a method that does not exist. The attempt was made from the following location:

坑三:org/apache/curator/framework/CuratorframeworkFactory

坑三:Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException:

坑四:Cannot resolve class 'Driver' 

坑五:exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/datatype/jsr310/ser/ZoneIdSerial




前言:

因为自己之前一直没有接触过boot+dubbo+zookeeper的项目。但公司的项目架构是用的这,所以就一直想搭建一个这样的服务。不得不说,自己动手实践起来还是有点小困难的。

此篇博客记录下自己搭建服务所遇到的坑,有的坑虽然已经解决,但是不是很清楚原因,先记录解决方案。等后续再补充原因。

坑一:LoggerFactory is not a Logback LoggerContext but Logback is on the classpath

1 报错信息:LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from。。。。。。

2 启动界面

 3 报错原因分析:

SLF4J: Found binding in [jar:file:/D:/Program%20Files/Ennis/MavenRepositories/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/Program%20Files/Ennis/MavenRepositories/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]

因为我当前没有单独导入任何有关日志包。所以很有肯能是我这两个依赖中自带的日志包相互冲突导致报错。

解决方案:

        

 看项目各个包的相互依赖关系,如果有爆红,说明依赖冲突。

 可以选中依赖爆红的地方,右键Exclude排除该jar包中的依赖。然后在pom文件中就会自动排除该依赖中冲突的jar包

 坑二:An attempt was made to call a method that does not exist. The attempt was made from the following location:

启动界面:

 这个坑也是依赖冲突单独记录下,因为是我们的zkclient客户端依赖中出现冲突:

只需要在zkclient中去除zookeeper依赖

    
    
      com.101tec
      zkclient
      0.10
      
        
          zookeeper
          org.apache.zookeeper
        
      
    

坑三:org/apache/curator/framework/CuratorframeworkFactory

解决方案:

在pom文件中加入:

    
      org.apache.curator
      curator-framework
      5.1.0
    

坑三:Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException:

启动报错:

 Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat

解决方案:

我之前版本号为2.3.8版本

 将版本改为2.0.6就可解决

  
    org.springframework.boot
    spring-boot-starter-parent
    2.0.6.RELEASE
  

坑四:Cannot resolve class 'Driver' 

出现问题:

pom中相关依赖: 

解决方案:

因为用了Spring-Boot-Parent中自带的版本号,可能相关依赖不能 导进,用个自带的版本号就可以解决。


      mysql
      mysql-connector-java
      8.0.19 
     
    

坑五:exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/datatype/jsr310/ser/ZoneIdSerial
    
      com.fasterxml.jackson.core
      jackson-databind
      2.8.1
    
    
      com.fasterxml.jackson.core
      jackson-annotations
      2.8.1
    

加入这两个依赖

此博客只记录自己遇到的问题,大家报的错可能是一样的,但是产生问题的原因可能不一样

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

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

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