美文网首页
java.lang.NoClassDefFoundError:

java.lang.NoClassDefFoundError:

作者: 帮我的鸵鸟盖个章 | 来源:发表于2021-04-20 16:59 被阅读0次

    Springboot dubbo zk 启动失败

    2021-04-20 16:52:36||PROJECT_IS_UNDEFINED||ENV_IS_UNDEFINED||SERVICE_NAME_IS_UNDEFINED||HOITBGHZNBX||ERROR||null||null||o.s.boot.SpringApplication||Application run failed
    java.lang.NoClassDefFoundError: org/apache/dubbo/config/spring/util/BeanRegistrar
        at org.apache.dubbo.spring.boot.beans.factory.config.OverrideBeanDefinitionRegistryPostProcessor.postProcessBeanDefinitionRegistry(OverrideBeanDefinitionRegistryPostProcessor.java:36)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:71)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at com.bnq.worker.WorkerWebApplication.main(WorkerWebApplication.java:21)
    Caused by: java.lang.ClassNotFoundException: org.apache.dubbo.config.spring.util.BeanRegistrar
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 12 common frames omitted
    Disconnected from the target VM, address: '127.0.0.1:55573', transport: 'socket'
    

    zk和dubbo的版本不匹配

    原因:

    1. 本地zk需与部署的zk版本一致
    2. dubbo需与zk版本匹配

    改之前

                <dependency>
                    <groupId>org.apache.dubbo</groupId>
                    <artifactId>dubbo</artifactId>
                    <version>2.7.5</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.dubbo</groupId>
                    <artifactId>dubbo-dependencies-zookeeper</artifactId>
                    <version>2.7.5</version>
                    <type>pom</type>
                </dependency>
                <dependency>
                    <groupId>org.apache.dubbo</groupId>
                    <artifactId>dubbo-spring-boot-starter</artifactId>
                    <version>2.7.1</version>
                </dependency>
    

    改之后

                <dependency>
                    <groupId>org.apache.dubbo</groupId>
                    <artifactId>dubbo</artifactId>
                    <version>2.7.3</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.dubbo</groupId>
                    <artifactId>dubbo-dependencies-zookeeper</artifactId>
                    <version>2.7.3</version>
                    <type>pom</type>
                </dependency>
                <dependency>
                    <groupId>org.apache.dubbo</groupId>
                    <artifactId>dubbo-spring-boot-starter</artifactId>
                    <version>2.7.1</version>
                </dependency>
    

    相关文章

      网友评论

          本文标题:java.lang.NoClassDefFoundError:

          本文链接:https://www.haomeiwen.com/subject/snvnlltx.html