jjzjj

java 11 spring boot2 redis运行时异常

coder 2023-07-19 原文

我从java 8迁移到java 11,编译顺利, 但是当运行版本为 jedis 3.0.0 的 spring boot 2 应用程序时,

我有以下错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getJedisConnectionFactory' defined in class resource path [/cache/configuration/RedisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'getJedisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: redis / clients / util / Pool
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod (ConstructorResolver.java:591)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod (AbstractAutowireCapableBeanFactory.java:1246)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance (AbstractAutowireCapableBeanFactory.java:1096)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:535)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:495)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda $ doGetBean $ 0 (AbstractBeanFactory.java:317)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:315)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:199)
        at org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.resolveBeanReference (ConfigurationClassEnhancer.java:396)
        at org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept (ConfigurationClassEnhancer.java:368)
        cache.configuration.RedisConfig $$ EnhancerBySpringCGLIB $$ e85c6eec.getJedisConnectionFactory (<generated>)
        at configuration.RedisConfig.redisTemplate (RedisConfig.java:30)
        at cache.configuration.RedisConfig $$ EnhancerBySpringCGLIB $$ e85c6eec.CGLIB $ redisTemplate $ 3 (<generated>)
        cache.configuration.RedisConfig $$ EnhancerBySpringCGLIB $$ e85c6eec $$ FastClassBySpringCGLIB $$ a6f08934.invoke (<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper (MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept (ConfigurationClassEnhancer.java:365)
        at cache.configuration.RedisConfig $$ EnhancerBySpringCGLIB $$ e85c6eec.redisTemplate (<generated>)
        at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
        at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
        at java.base / jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
        at java.base / java.lang.reflect.Method.invoke (Method.java:566)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate (SimpleInstantiationStrategy.java:154)
        ... more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'getJedisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: redis / clients / util / Pool
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate (SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod (ConstructorResolver.java:583)
        ... 138 more
Caused by: java.lang.NoClassDefFoundError: redis / clients / util / Pool
        at cache.configuration.RedisConfig.getJedisConnectionFactory (RedisConfig.java:55)
        at cache.configuration.RedisConfig $$ EnhancerBySpringCGLIB $$ e85c6eec.CGLIB $ getJedisConnectionFactory $ 0 (<generated>)
        at cache.configuration.RedisConfig $$ EnhancerBySpringCGLIB $$ e85c6eec $$ FastClassBySpringCGLIB $$ a6f08934.invoke (<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper (MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept (ConfigurationClassEnhancer.java:365)

谢谢

最佳答案

Spring Boot 2 与 Jedis 2.9 兼容,因此您将无法使用 3.0.0。

参见 https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#appendix-dependency-versions了解更多信息。

关于java 11 spring boot2 redis运行时异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53741916/

有关java 11 spring boot2 redis运行时异常的更多相关文章

  1. ruby - 如何从 ruby​​ 中的字符串运行任意对象方法? - 2

    总的来说,我对ruby​​还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用

  2. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  3. ruby - 如何每月在 Heroku 运行一次 Scheduler 插件? - 2

    在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/

  4. ruby-on-rails - 如何在 ruby​​ 中使用两个参数异步运行 exe? - 2

    exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby​​中使用两个参数异步运行exe吗?我已经尝试过ruby​​命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何ruby​​gems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除

  5. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  6. ruby - Sinatra:运行 rspec 测试时记录噪音 - 2

    Sinatra新手;我正在运行一些rspec测试,但在日志中收到了一堆不需要的噪音。如何消除日志中过多的噪音?我仔细检查了环境是否设置为:test,这意味着记录器级别应设置为WARN而不是DEBUG。spec_helper:require"./app"require"sinatra"require"rspec"require"rack/test"require"database_cleaner"require"factory_girl"set:environment,:testFactoryGirl.definition_file_paths=%w{./factories./test/

  7. java - 等价于 Java 中的 Ruby Hash - 2

    我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/

  8. ruby-on-rails - 无法让 rspec、spork 和调试器正常运行 - 2

    GivenIamadumbprogrammerandIamusingrspecandIamusingsporkandIwanttodebug...mmm...let'ssaaay,aspecforPhone.那么,我应该把“require'ruby-debug'”行放在哪里,以便在phone_spec.rb的特定点停止处理?(我所要求的只是一个大而粗的箭头,即使是一个有挑战性的程序员也能看到:-3)我已经尝试了很多位置,除非我没有正确测试它们,否则会发生一些奇怪的事情:在spec_helper.rb中的以下位置:require'rubygems'require'spork'

  9. java - 从 JRuby 调用 Java 类的问题 - 2

    我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www

  10. ruby-on-rails - before_filter 运行多个方法 - 2

    是否有可能:before_filter:authenticate_user!||:authenticate_admin! 最佳答案 before_filter:do_authenticationdefdo_authenticationauthenticate_user!||authenticate_admin!end 关于ruby-on-rails-before_filter运行多个方法,我们在StackOverflow上找到一个类似的问题: https://

随机推荐