Spring Boot + Maven を使用してこの Spring-Session の例をセットアップしようとしていました (GIT リンクのソースは Gradle を使用しています)。コンパイル エラーはありませんでした。デプロイ可能な WAR ファイルも、再パッケージ ゴールを使用して生成されました。
WildFly サーバーに WAR ファイルをデプロイしようとすると、Redis に関連する次のエラーが発生します。自分のマシンで Redis サーバーを実行していません (デプロイされた WAR ファイルであっても、組み込みの Redis インスタンスがアプリケーションの一部として作成されると想定しているため)
ファイル: 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)
環境: ドメイン モードで実行されている WildFly8.2 (フル HA プロファイルで実行されている 3 つのノード) アプリケーション: Spring Boot + Spring Session + Maven
質問: このエラーは、WAR ファイルがコンテナーにデプロイされている間、組み込みの Redis インスタンスを作成できないためですか? これを実行可能な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]