使用Maven和Spring引导的Spring会话示例中的Redis错误

使用Maven和Spring引导的Spring会话示例中的Redis错误,maven,redis,wildfly,spring-data-redis,spring-session,Maven,Redis,Wildfly,Spring Data Redis,Spring Session,我试图使用SpringBoot+Maven进行设置(GIT链接中的源代码使用的是Gradle)。没有编译错误,可部署的WAR文件也是使用重新打包目标生成的 当尝试在我的WildFly服务器中部署WAR文件时,我遇到了以下与Redis相关的错误。我的机器上没有运行Redis服务器(因为我假设嵌入式Redis实例将作为应用程序的一部分创建,即使是在部署的WAR文件中) 文件:EmbeddedRedisConfiguration.java 由引起: java.lang.NullPointerExcep

我试图使用SpringBoot+Maven进行设置(GIT链接中的源代码使用的是Gradle)。没有编译错误,可部署的WAR文件也是使用重新打包目标生成的

当尝试在我的WildFly服务器中部署WAR文件时,我遇到了以下与Redis相关的错误。我的机器上没有运行Redis服务器(因为我假设嵌入式Redis实例将作为应用程序的一部分创建,即使是在部署的WAR文件中)

文件:EmbeddedRedisConfiguration.java

引起:

java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203) [rt.jar:1.8.0_25]
at java.nio.file.Files.copy(Files.java:2984) [rt.jar:1.8.0_25]
at redis.embedded.RedisServer.extractExecutableFromJar(RedisServer.java:85)
at redis.embedded.RedisServer.<init>(RedisServer.java:69)
at redis.embedded.RedisServer.<init>(RedisServer.java:63)
at hello.EmbeddedRedisConfiguration$RedisServerBean.afterPropertiesSet(EmbeddedRedisConfiguration.java:55)
java.lang.NullPointerException
在java.util.Objects.requirennull(Objects.java:203)[rt.jar:1.8.0_25]
在java.nio.file.Files.copy(Files.java:2984)[rt.jar:1.8.0_25]
位于redis.embedded.RedisServer.extractExecutableFromJar(RedisServer.java:85)
位于redis.embedded.rediserver。(RedisServer.java:69)
位于redis.embedded.rediserver。(RedisServer.java:63)
位于hello.EmbeddedRedisConfiguration$RedisServerBean.AfterPropertieSet(EmbeddedRedisConfiguration.java:55)
环境:以域模式运行的WildFly8.2(3个节点以完整HA配置文件运行) 应用程序:Spring启动+Spring会话+Maven

问题:此错误是因为无法创建嵌入式Redis实例吗 在WAR文件部署到容器时创建?我没有 已尝试将此作为可执行WAR文件运行

完成错误堆栈

[Server:server-four] 23:52:46,815 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host."/gs-spring-boot-0.1.0": org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host."/gs-spring-boot-0.1.0": Failed to start service
[Server:server-four]    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
[Server:server-four]    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
[Server:server-four]    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
[Server:server-four]    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
[Server:server-four] Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisServer' defined in class path resource [hello/EmbeddedRedisConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NullPointerException
[Server:server-four]    at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:222)
[Server:server-four]    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
[Server:server-four]    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
[Server:server-four]    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
[Server:server-four]    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
[Server:server-four]    ... 3 more
[Server:server-four] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisServer' defined in class path resource [hello/EmbeddedRedisConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NullPointerException
[Server:server-four]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
[Server:server-four]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
[Server:server-four]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
[Server:server-four]    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
[Server:server-four]    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
[Server:server-four]    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
[Server:server-four]    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
[Server:server-four]    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:116)
[Server:server-four]    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:611)
[Server:server-four]    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
[Server:server-four]    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
[Server:server-four]    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
[Server:server-four]    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
[Server:server-four]    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
[Server:server-four]    at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89)
[Server:server-four]    at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51)
[Server:server-four]    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
[Server:server-four]    at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:182)
[Server:server-four]    ... 7 more
**[Server:server-four] Caused by: java.lang.NullPointerException
[Server:server-four]    at java.util.Objects.requireNonNull(Objects.java:203) [rt.jar:1.8.0_25]
[Server:server-four]    at java.nio.file.Files.copy(Files.java:2984) [rt.jar:1.8.0_25]
[Server:server-four]    at redis.embedded.RedisServer.extractExecutableFromJar(RedisServer.java:85)
[Server:server-four]    at redis.embedded.RedisServer.<init>(RedisServer.java:69)
[Server:server-four]    at redis.embedded.RedisServer.<init>(RedisServer.java:63)
[Server:server-four]    at hello.EmbeddedRedisConfiguration$RedisServerBean.afterPropertiesSet(EmbeddedRedisConfiguration.java:55)**
[Server:server-four]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
[Server:server-four]    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
[Server:server-four]    ... 24 more
[Server:server-four] 
[Server:Server four]23:52:46815错误[org.jboss.msc.service.fail](msc服务线程1-4)MSC000001:无法启动服务jboss.undertow.deployment.default Server.default host。“/gs-spring-boot-0.1.0”:org.jboss.msc.service.StartException in service jboss.undertow.deployment.default Server.default host。”/gs-spring-boot-0.1.0”:无法启动服务
[服务器:服务器四]位于org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
[Server:Server-four]位于java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[rt.jar:1.8.025]
[Server:Server-four]位于java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[rt.jar:1.8.0_25]
位于java.lang.Thread.run(Thread.java:745)的[Server:serverfour]
[Server:Server-four]原因:java.lang.RuntimeException:org.springframework.beans.factory.BeanCreationException:创建类路径资源[hello/EmbeddedRedisConfiguration.class]中定义的名为“redisServer”的bean时出错:调用init方法失败;嵌套异常是java.lang.NullPointerException
[Server:Server-four]位于io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:222)
[服务器:服务器4]位于org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
[服务器:服务器4]位于org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
[服务器:服务器四]位于org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
[Server:Server-four]位于org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)[jboss-msc-1.2.2.Final.jar:1.2.2.Final]
[服务器:服务器4]。。。3个以上
[Server:Server-four]原因:org.springframework.beans.factory.BeanCreationException:创建在类路径资源[hello/EmbeddedRedisConfiguration.class]中定义的名为“redisServer”的bean时出错:调用init方法失败;嵌套异常是java.lang.NullPointerException
[Server:Server-four]位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
[Server:serverfour]位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
[Server:serverfour]位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
[Server:serverfour]位于org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
[Server:Server-four]位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
[Server:serverfour]位于org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
[Server:serverfour]位于org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
位于org.springframework.context.support.postprocessorregistrationlegate.invokeBeanFactoryPostProcessors(postprocessorregistrationlegate.java:116)的[Server:Server-four]
位于org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:611)的[Server:ServerFour]
[Server:Server-four]位于org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
[Server:Server-four]位于org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
[Server:serverfour]位于org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
[Server:serverfour]位于org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
[服务器:服务器四]位于org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
[Server:Server-four]位于org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89)
[服务器:服务器四]位于org.springframework.boot.context.web.SpringBootServletInitializer.onStartup