您的位置:首页 > 财经 > 产业 > 接单类型网站建设费用_义乌外发加工网是正规的吗_长沙推广引流_电商代运营十大公司排名

接单类型网站建设费用_义乌外发加工网是正规的吗_长沙推广引流_电商代运营十大公司排名

2024/11/16 12:25:19 来源:https://blog.csdn.net/nxg0916/article/details/143371559  浏览:    关键词:接单类型网站建设费用_义乌外发加工网是正规的吗_长沙推广引流_电商代运营十大公司排名
接单类型网站建设费用_义乌外发加工网是正规的吗_长沙推广引流_电商代运营十大公司排名

遇到的问题

报错:

The called method's class, org.apache.commons.pool2.impl.GenericObjectPoolConfig, is available from the following locations:jar:file:/D:/software/maven/mavenRepository/org/apache/commons/commons-pool2/2.9.0/commons-pool2-2.9.0.jar!/org/apache/commons/pool2/impl/GenericObjectPoolConfig.class
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory and org.apache.commons.pool2.impl.GenericObjectPoolConfig

pom配置:

    <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.12</version><relativePath/> <!-- lookup parent from repository --></parent><dependencies><!--redis依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!-- redis依赖commons-pool 这个依赖一定要添加 --><dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId><version>2.9.0</version></dependency><dependencies>

原因:
commons-pool2版本与redis版本不一致导致的

解决方法

方法1:
选择redis跟commons-pool2合适的版本:

        <dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId><version>2.11.1</version></dependency>

当时去掉commons-pool2依赖也可以
spring-boot-starter-parent版本2.7.12对应commons-pool2版本2.11.1

方法2:
切换springboot版本:

    <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.4.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><dependencies><!--redis依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!-- redis依赖commons-pool 这个依赖一定要添加 --><dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId></dependency><dependencies>

spring-boot-starter-parent版本2.3.4.RELEASE对应的commons-pool2版本是2.8.1
redis不指定版本就跟随spring-boot-starter-parent指定的版本

附件

详细报错:

2024-10-30 18:09:44.535  INFO 27524 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 7045 ms
2024-10-30 18:09:45.090 ERROR 27524 --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'jwtAuthenticationTokenFilter': Unsatisfied dependency expressed through field 'redisCache'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisCache': Unsatisfied dependency expressed through field 'redisTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisTemplate' defined in class path resource [cn/zyroot/domain/security/config/RedisConfig.class]: Unsatisfied dependency expressed through method 'redisTemplate' parameter 0; nested exception is 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.NoSuchMethodError: org.apache.commons.pool2.impl.GenericObjectPoolConfig.setMaxWait(Ljava/time/Duration;)V
2024-10-30 18:09:45.189  INFO 27524 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-10-30 18:09:45.203  WARN 27524 --- [           main] o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [lettuce-timer-3-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:java.lang.Thread.sleep(Native Method)io.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:600)io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:496)io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)java.lang.Thread.run(Thread.java:748)
2024-10-30 18:09:45.213  WARN 27524 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2024-10-30 18:09:45.309  INFO 27524 --- [           main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-10-30 18:09:45.404 ERROR 27524 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : ***************************
APPLICATION FAILED TO START
***************************Description:An attempt was made to call a method that does not exist. The attempt was made from the following location:org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory.getPoolConfig(LettuceConnectionConfiguration.java:188)The following method did not exist:org.apache.commons.pool2.impl.GenericObjectPoolConfig.setMaxWait(Ljava/time/Duration;)VThe calling method's class, org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory, was loaded from the following location:jar:file:/D:/software/maven/mavenRepository/org/springframework/boot/spring-boot-autoconfigure/2.7.12/spring-boot-autoconfigure-2.7.12.jar!/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration$PoolBuilderFactory.classThe called method's class, org.apache.commons.pool2.impl.GenericObjectPoolConfig, is available from the following locations:jar:file:/D:/software/maven/mavenRepository/org/apache/commons/commons-pool2/2.9.0/commons-pool2-2.9.0.jar!/org/apache/commons/pool2/impl/GenericObjectPoolConfig.classThe called method's class hierarchy was loaded from the following locations:org.apache.commons.pool2.impl.GenericObjectPoolConfig: file:/D:/software/maven/mavenRepository/org/apache/commons/commons-pool2/2.9.0/commons-pool2-2.9.0.jarorg.apache.commons.pool2.impl.BaseObjectPoolConfig: file:/D:/software/maven/mavenRepository/org/apache/commons/commons-pool2/2.9.0/commons-pool2-2.9.0.jarorg.apache.commons.pool2.BaseObject: file:/D:/software/maven/mavenRepository/org/apache/commons/commons-pool2/2.9.0/commons-pool2-2.9.0.jarAction:Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory and org.apache.commons.pool2.impl.GenericObjectPoolConfigDisconnected from the target VM, address: '127.0.0.1:59300', transport: 'socket'Process finished with exit code 1

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com