https://www.leafage.top/posts/detail/21622MARQ璁板綍涓€涓猺edis鐨勫紓甯革紝浠婂ぉ鏇存柊娴"/>

NoClassDefFoundError锛欸enericObjectPoolConfig 闂

Posted 甯冨悏宀?,

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NoClassDefFoundError锛欸enericObjectPoolConfig 闂相关的知识,希望对你有一定的参考价值。

鏈枃涓汉鍗氬鍦板潃锛?a href="https://link.segmentfault.com/?url=https%3A%2F%2Fwww.leafage.top%2Fposts%2Fdetail%2F21622MARQ" rel="nofollow">https://www.leafage.top/posts/detail/21622MARQ

璁板綍涓€涓猺edis鐨勫紓甯革紝浠婂ぉ鏇存柊娴嬭瘯鐜鐨勬湇鍔★紝璇ユ湇鍔′腑浣跨敤浜?spring-boot-starter-data-redis 鐨勪緷璧栵紝鍦ㄥ彂甯冩祴璇曠殑鏃跺€欐姤閿欎簡锛屽緢灏村艾銆備负鍟ュ憿锛屾垜鏈湴杩愯鐨勫ソ濂界殑鍛€銆傘€傘€傦紙鏄笉鏄綘鐨勬棩甯革紵馃槀锛夈€?/p>

杩欎釜閿欑殑鍏蜂綋淇℃伅濡備笅锛?/p>

     6    2021-06-22 09:23:17,291 [application-name] [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name \'redisConnectionFactory\' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]: Factory method \'redisConnectionFactory\' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig
     7    2021-06-22 09:23:17,343 [application-name] [main] ERROR o.s.b.SpringApplication - Application run failed
     8    org.springframework.beans.factory.BeanCreationException: Error creating bean with name \'redisConnectionFactory\' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]: Factory method \'redisConnectionFactory\' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig
     9        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
    10        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:637)
    11        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1341)
    12        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1181)
    13        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
    14        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    15        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
    16        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    17        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    18        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    19        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
    20        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
    21        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    22        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
    23        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
    24        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
    25        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
    26        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    27        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
    28        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    29        at com.ichinae.imis.MgrApplication.main(MgrApplication.java:20)
    30        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    31        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    32        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    33        at java.lang.reflect.Method.invoke(Method.java:498)
    34        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    35        at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
    36        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    37        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
    38    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]: Factory method \'redisConnectionFactory\' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig
    39        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    40        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:652)
    41        ... 28 common frames omitted
    42    Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig
    43        at org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration$LettucePoolingClientConfigurationBuilder.<init>(LettucePoolingClientConfiguration.java:94)
    44        at org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration.builder(LettucePoolingClientConfiguration.java:51)
    45        at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory.createBuilder(LettuceConnectionConfiguration.java:159)
    46        at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration.createBuilder(LettuceConnectionConfiguration.java:107)
    47        at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration.getLettuceClientConfiguration(LettuceConnectionConfiguration.java:92)
    48        at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration.redisConnectionFactory(LettuceConnectionConfiguration.java:74)
    49        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    50        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    51        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    52        at java.lang.reflect.Method.invoke(Method.java:498)
    53        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    54        ... 29 common frames omitted
    55    Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.GenericObjectPoolConfig
    56        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    57        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    58        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
    59        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    60        ... 40 common frames omitted
鍍忓線甯镐竴鏍凤紝copy 寮傚父淇℃伅锛岀矘璐寸殑google鎼滀竴涓嬶紝鐒跺悗浠嬬粛鐨勯兘鏄环鏍间互apache common pool2 鐨勪緷璧栵紝鐒跺悗杩樻湁绔熺劧璇撮噸寤轰竴涓」鐩埌銆傘€傘€傦紙鍏勫紵浣犳悶绗戠殑鍚ю煓勶級銆?/blockquote>

鏉ヨ涓嬭繖涓紓甯哥殑鍘熷洜锛屾姤杩欎釜閿欑殑鍘荤湅涓嬩綘鐨勯厤缃枃浠朵腑鏄笉鏄厤缃簡 lettuce.pool 鐨勯厤缃俊鎭紝
濡傛灉鏈夐偅灏卞浜嗭紝瑙e喅鐨勬柟娉曟湁涓や釜锛?/p>

  1. 鍥犱负鍚姩鏃舵潵鍔犺浇鍣ㄦ壘涓嶅埌common-pool2鐨勭浉鍏崇被锛岄偅涔堝氨缁欏畠鎶婄浉鍏崇被寮曞叆锛屾坊鍔犱緷璧栵細

    <dependency>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-pool2</artifactId>
    </dependency>
  2. 绉婚櫎lettuce.pool鐨勯厤缃紝濡傛灉浣犻兘鐢ㄤ笉鍒帮紝鎴栬€呴兘鏄鍒惰繃鏉ョ殑閰嶇疆锛屽氨鐢ㄩ粯璁ょ殑灏卞彲浠ワ紝鍒犻櫎杩欎釜鐩稿叧閰嶇疆銆?/li>

以上是关于NoClassDefFoundError锛欸enericObjectPoolConfig 闂的主要内容,如果未能解决你的问题,请参考以下文章

mac锛欸o瀹夎鍜岄厤缃?GoLand瀹夎鍜屼娇鐢ㄤ箣瀹屾暣鏁欑▼

鍔ㄥ浘璇﹁В锛欸oogle缈昏瘧鑳屽悗鐨勬満鍣ㄥ涔犵畻娉曚笌绁炵粡缃戠粶妯″瀷

指标详解-- 轨道线指标(ENE)详解

java.lang.NoClassDefFoundError

NoClassDefFoundError

NoClassDefFoundError