java连接redis,日志报错java.lang.IllegalStateException

这篇具有很好参考价值的文章主要介绍了java连接redis,日志报错java.lang.IllegalStateException。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

日志具体报错如下,无法启动应用

D:\Java\jdk1.8.0_77\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:D:\SoftWare\IntelliJ IDEA 2020.3.3\lib\idea_rt.jar=49817:D:\SoftWare\IntelliJ IDEA 2020.3.3\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath D:\Java\jdk1.8.0_77\jre\lib\charsets.jar;D:\Java\jdk1.8.0_77\jre\lib\deploy.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\access-bridge-64.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\cldrdata.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\dnsns.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\jaccess.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\jfxrt.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\localedata.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\nashorn.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\sunec.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\sunjce_provider.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\sunmscapi.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\sunpkcs11.jar;D:\Java\jdk1.8.0_77\jre\lib\ext\zipfs.jar;D:\Java\jdk1.8.0_77\jre\lib\javaws.jar;D:\Java\jdk1.8.0_77\jre\lib\jce.jar;D:\Java\jdk1.8.0_77\jre\lib\jfr.jar;D:\Java\jdk1.8.0_77\jre\lib\jfxswt.jar;D:\Java\jdk1.8.0_77\jre\lib\jsse.jar;D:\Java\jdk1.8.0_77\jre\lib\management-agent.jar;D:\Java\jdk1.8.0_77\jre\lib\plugin.jar;D:\Java\jdk1.8.0_77\jre\lib\resources.jar;D:\Java\jdk1.8.0_77\jre\lib\rt.jar;D:\IDEA_project\demo_redis\target\classes;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot-starter-data-redis\2.7.6\spring-boot-starter-data-redis-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot-starter\2.7.6\spring-boot-starter-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot\2.7.6\spring-boot-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot-autoconfigure\2.7.6\spring-boot-autoconfigure-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot-starter-logging\2.7.6\spring-boot-starter-logging-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\SoftWare\apache-maven-3.6.0\repository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\SoftWare\apache-maven-3.6.0\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\lettuce\lettuce-core\6.1.10.RELEASE\lettuce-core-6.1.10.RELEASE.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\netty\netty-common\4.1.85.Final\netty-common-4.1.85.Final.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\netty\netty-handler\4.1.85.Final\netty-handler-4.1.85.Final.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\netty\netty-resolver\4.1.85.Final\netty-resolver-4.1.85.Final.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\netty\netty-buffer\4.1.85.Final\netty-buffer-4.1.85.Final.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\netty\netty-transport-native-unix-common\4.1.85.Final\netty-transport-native-unix-common-4.1.85.Final.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\netty\netty-codec\4.1.85.Final\netty-codec-4.1.85.Final.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\netty\netty-transport\4.1.85.Final\netty-transport-4.1.85.Final.jar;D:\SoftWare\apache-maven-3.6.0\repository\io\projectreactor\reactor-core\3.4.25\reactor-core-3.4.25.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\reactivestreams\reactive-streams\1.0.4\reactive-streams-1.0.4.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot-starter-web\2.7.6\spring-boot-starter-web-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot-starter-json\2.7.6\spring-boot-starter-json-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\com\fasterxml\jackson\core\jackson-databind\2.13.4.2\jackson-databind-2.13.4.2.jar;D:\SoftWare\apache-maven-3.6.0\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.4\jackson-annotations-2.13.4.jar;D:\SoftWare\apache-maven-3.6.0\repository\com\fasterxml\jackson\core\jackson-core\2.13.4\jackson-core-2.13.4.jar;D:\SoftWare\apache-maven-3.6.0\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.4\jackson-datatype-jdk8-2.13.4.jar;D:\SoftWare\apache-maven-3.6.0\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.4\jackson-datatype-jsr310-2.13.4.jar;D:\SoftWare\apache-maven-3.6.0\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.4\jackson-module-parameter-names-2.13.4.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.6\spring-boot-starter-tomcat-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.69\tomcat-embed-core-9.0.69.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.69\tomcat-embed-el-9.0.69.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.69\tomcat-embed-websocket-9.0.69.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-web\5.3.24\spring-web-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-beans\5.3.24\spring-beans-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-webmvc\5.3.24\spring-webmvc-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-context\5.3.24\spring-context-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-expression\5.3.24\spring-expression-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\data\spring-data-redis\1.7.2.RELEASE\spring-data-redis-1.7.2.RELEASE.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\data\spring-data-keyvalue\2.7.6\spring-data-keyvalue-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\data\spring-data-commons\2.7.6\spring-data-commons-2.7.6.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-tx\5.3.24\spring-tx-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-oxm\5.3.24\spring-oxm-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-aop\5.3.24\spring-aop-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-context-support\5.3.24\spring-context-support-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\slf4j\jcl-over-slf4j\1.7.36\jcl-over-slf4j-1.7.36.jar;D:\SoftWare\apache-maven-3.6.0\repository\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\apache\commons\commons-pool2\2.11.1\commons-pool2-2.11.1.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-core\5.3.24\spring-core-5.3.24.jar;D:\SoftWare\apache-maven-3.6.0\repository\org\springframework\spring-jcl\5.3.24\spring-jcl-5.3.24.jar com.example.demo.DemoApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.6)

2024-01-22 09:53:27.701  INFO 7912 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication using Java 1.8.0_77 on LAPTOP-MBCTH7PD with PID 7912 (D:\IDEA_project\demo_redis\target\classes started by huayu in D:\IDEA_project\demo_redis)
2024-01-22 09:53:27.706  INFO 7912 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to 1 default profile: "default"
2024-01-22 09:53:28.422 ERROR 7912 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration.redisConnectionFactory
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ~[spring-boot-autoconfigure-2.7.6.jar:2.7.6]
	at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:193) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:153) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.7.6.jar:2.7.6]
	at com.example.demo.DemoApplication.main(DemoApplication.java:10) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:485) ~[spring-core-5.3.24.jar:5.3.24]
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:361) ~[spring-core-5.3.24.jar:5.3.24]
	at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:418) ~[spring-core-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:765) ~[spring-beans-5.3.24.jar:5.3.24]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_77]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:764) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:703) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:674) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1684) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:250) ~[spring-boot-autoconfigure-2.7.6.jar:2.7.6]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:243) ~[spring-boot-autoconfigure-2.7.6.jar:2.7.6]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:233) ~[spring-boot-autoconfigure-2.7.6.jar:2.7.6]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:181) ~[spring-boot-autoconfigure-2.7.6.jar:2.7.6]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:156) ~[spring-boot-autoconfigure-2.7.6.jar:2.7.6]
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.7.6.jar:2.7.6]
	... 17 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration$LettuceClientConfigurationBuilder
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_77]
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_77]
	at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_77]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:467) ~[spring-core-5.3.24.jar:5.3.24]
	... 33 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration$LettuceClientConfigurationBuilder
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_77]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_77]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
	... 37 common frames omitted

2024-01-22 09:53:28.427  WARN 7912 --- [           main] o.s.boot.SpringApplication               : Unable to close ApplicationContext

java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:485) ~[spring-core-5.3.24.jar:5.3.24]
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:361) ~[spring-core-5.3.24.jar:5.3.24]
	at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:418) ~[spring-core-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:765) ~[spring-beans-5.3.24.jar:5.3.24]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_77]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:764) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:703) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:674) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1684) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:669) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:661) ~[spring-beans-5.3.24.jar:5.3.24]
	at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1300) ~[spring-context-5.3.24.jar:5.3.24]
	at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:864) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:852) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:839) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:779) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:317) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.7.6.jar:2.7.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.7.6.jar:2.7.6]
	at com.example.demo.DemoApplication.main(DemoApplication.java:10) [classes/:na]
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration$LettuceClientConfigurationBuilder
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_77]
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_77]
	at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_77]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:467) ~[spring-core-5.3.24.jar:5.3.24]
	... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration$LettuceClientConfigurationBuilder
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_77]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_77]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
	... 25 common frames omitted


Process finished with exit code 1

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
            <version>1.7.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <image>
                        <builder>paketobuildpacks/builder-jammy-base:latest</builder>
                    </image>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

java程序

package com.example.demo.controller;


import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestRedis {

    @Autowired
    public StringRedisTemplate redisTemplate;

    @GetMapping("count")
    public String count(){
        long count = redisTemplate.opsForValue().increment("count",1);

        return "有【"+count+"】人访问了页面";
    }

}

出现这种问题的原因是版本不合适,使用springboot版本2.7.6,但是使用spring-boot-date的版本是1.7.2.RELEASE
注释版本
java连接redis,日志报错java.lang.IllegalStateException,java,java,redis,开发语言
重新启动java程序,启动成功
java连接redis,日志报错java.lang.IllegalStateException,java,java,redis,开发语言文章来源地址https://www.toymoban.com/news/detail-818629.html

到了这里,关于java连接redis,日志报错java.lang.IllegalStateException的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • java反射异常报错解决:java.lang.NoSuchFieldException

    我这里是学习测试开发时报错,关联:运行代码中调用另一个代码文件的私有属性并且这个私有属性还需与本地excel文件中的title一致! 报错信息如下图: 69行代码: 103行代码:  Caseinfo私有属性代码: excel下标0行的列头: 总结:最终通过反复查看java.lang.NoSuchFieldException源代

    2024年02月12日
    浏览(43)
  • 报错throws java.lang.ClassFormatError accessible: module java.base does not “opens java.lang“

    有时候项目在前端浏览某些页面时,会突然报如下错误: 与此同时,后端也会跟着报错:  问题表现出来的现象就是非法反射访问警告,之前系统运行都没问题,怎么突然就报这种错误哪,会把人搞得措手不及、不知如何处理。 其实这里有一个非常重要的线索: throws java

    2024年02月07日
    浏览(48)
  • Mybatisplus报错 field private final java.lang.Class java.lang.invoke.SerializedLambda.capturingClass

    Unable to make field private final java.lang.Class java.lang.invoke.SerializedLambda.capturingClass accessible: module java.base does not “opens java.lang.invoke” to unnamed module @6dc17b83 其实是Mybatisplus和Java的版本兼容出现了问题。 这个错误是因为在 Java 9 及之后的版本中,模块化系统 (Module System) 引入了访问限

    2024年02月04日
    浏览(56)
  • IDEA报错:java.lang.NoSuchFieldError 和 NoSuchMethodError

    1、报错信息 java.lang.NoSuchFieldError 和 NoSuchMethodError 2、场景 通过Maven引入了一个jar包,某一天新增了一个类的属性或者静态属性。然后发现编译完全正确,但是实际运行一直在报NoSuchFieldError。 3、造成原因只有以下两种(不用想其他的,没有其他可能) 1、你项目中有同一个

    2024年02月10日
    浏览(43)
  • RedisTemplate使用zadd报错java.lang.StackOverflowError

    代码当中使用RedisTemplate操作String、List都是正常的,但是操作zadd就会报错,有人说是这两个依赖的版本不一致的问题,但是项目中还有其他地方要用到,所以改版本号行不通, 下面是我操作的核心代码 起初我认为是版本号不一致的问题,因为线上服务器是7.0,本地是5.0,但

    2024年01月16日
    浏览(34)
  • 项目bug——编码问题报错(java.lang.IllegalStateException)

    项目拉下后报错 2023-07-17 14:26:07.596 ERROR 14300 — [ main] o.s.boot.SpringApplication : Application run failed java.lang.IllegalStateException: Failed to load property source from ‘file:/Users/wang/IdeaProjects/ms-family-pre/target/classes/application.yaml’ (classpath:/application.yaml) at org.springframework.boot.context.config.ConfigFileAppl

    2024年02月16日
    浏览(53)
  • 【Android】报错java.lang.reflect.InvocationTargetException解决办法

    结果图 原因 InvocationTargetException异常由Method.invoke(obj, args…)方法抛出。(反射异常) 当被调用的方法的内部抛出了异常而没有被捕获时,将由此异常接收!!! 反射层将所有的异常都包装在一个InvocationTargetException 中,能使你区分异常的实际上是反射层的引起的一个调用失败(

    2024年01月21日
    浏览(44)
  • 已解决java.lang.ClassNotFoundException——java连接mysql8/mysql5

    这里大家没必要去mysql官网安装,可以直接安装phpStudy_pro,毕竟小皮面板的宣言是让天下没有难配的服务器环境,如下是小皮面板的界面(同样的,此次用到的所有资料文末公众号可免费领取): 官网下载或者找公众号免费资料包均可: 官网地址:https://downloads.mysql.com/archiv

    2024年01月21日
    浏览(55)
  • Android报错:compileDebugJavaWithJavac FAILED、java.lang.AssertionError: annotationType()

    compileSdk:33 targetSdk:33 gradle:6.9.4 JDK:1.8.0 方法1 、删除代码中的这个注解  @Deprecated ,如下图所示: 方法2 、升级JDK到11 网上搜查 compileDebugJavaWithJavac FAILED 基本都是将compileSdk和targetSdk修改到30(及)以下,但试过发现未解决我的问题。 然后又试了几个我怀疑的地方还是不行。

    2024年02月09日
    浏览(37)
  • 记报错信息:java.lang.IllegalArgumentException: MALFORMED解决方案

    在调用JDK自带的zipfile读取压缩包文件的时候,出现了以下错误: SjXcmcFeignClient:124 - BaseFeignClient 拦截到【未知系统异常】Exception异常: java.lang.IllegalArgumentException: MALFORMED[1] at java.util.zip.ZipCoder.toString(ZipCoder.java:65) at java.util.zip.ZipFile.getZipEntry(ZipFile.java:583) at java.util.zip.ZipFile.ac

    2024年02月05日
    浏览(57)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包