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

发布时间:2024年01月22日

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

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程序,启动成功
在这里插入图片描述

文章来源:https://blog.csdn.net/qiao2458/article/details/135742595
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。