我在CloudFoundry(PWS)中运行我的应用程序并尝试利用Spring Cloud AWS Elasticache支持来缓存数据。我的配置如下所示 -
<aws-context:context-region region="us-east-1"/>
<aws-context:context-credentials>
<aws-context:simple-credentials access-key="${my.accessKey}" secret-key="${my.secretKey}"/>
</aws-context:context-credentials>
<aws-cache:cache-manager id="cacheManager">
<aws-cache:cache-cluster name="A" expiration="864000"/>
<aws-cache:cache-cluster name="B" expiration="2592000"/>
<aws-cache:cache-cluster name="C" expiration="2592000"/>
</aws-cache:cache-manager>
在我的DAO中,我有 -
@Cacheable(值=&#34; A&#34;,键=&#34;#p0&#34;) public Board findById(Long id)抛出DataAccessException {}
但我似乎无法通过IdleConnectionReaper睡眠中断问题。请参阅下面的错误详情 -
2015-05-29T02:32:35.17-0400 [App/0] OUT 2015-05-29 06:32:35,174 - DEBUG localhost-startStop-1 com.amazonaws.request - Received successful response: 200, AWS Request ID: XXXXXXXXXXX
2015-05-29T02:32:35.18-0400 [App / 0] OUT at java.lang.Thread.sleep(Native Method)
2015-05-29T02:32:35.18-0400 [App / 0] OUT 2015-05-29 06:32:35,178 - DEBUG java-sdk-http-connection-reaper com.amazonaws.http.IdleConnectionReaper - Reaper线程:
2015-05-29T02:32:35.18-0400 [App / 0] OUT java.lang.InterruptedException:sleep interrupted
2015-05-29T02:32:35.18-0400 [App / 0] OUT at com.amazonaws.http.IdleConnectionReaper.run(IdleConnectionReaper.java:112)
2015-05-29T02:32:35.18-0400 [App / 0] OUT 2015-05-29 06:32:35,183 - DEBUG java-sdk-http-connection-reaper com.amazonaws.http.IdleConnectionReaper - 正在关闭收割机线程。
2015-05-29T02:32:35.18-0400 [App / 0] OUT org.springframework.beans.factory.BeanCreationException:创建名称为&#39; cacheManager&#39;的错误:无法创建内部bean&#39; 39;(内豆)#3068a787&#39;类型为[org.springframework.cloud.aws.cache.ElastiCacheFactoryBean]时设置bean属性&#39;缓存&#39;用键[0];嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为&#39;(内部bean)的bean时出错#3068a787&#39;:init方法的调用失败;嵌套异常是java.lang.NullPointerException
2015-05-29T02:32:35.18-0400 [App / 0] OUT 2015-05-29 06:32:35,183 - ERROR localhost-startStop-1 org.springframework.web.servlet.DispatcherServlet - 上下文初始化失败
2015-05-29T02:32:35.18-0400 [App / 0] OUT org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290)<
...
2015-05-29T02:32:35.18-0400 [App / 0] OUT引起:java.lang.NullPointerException
2015-05-29T02:32:35.18-0400 [App / 0] OUT org.springframework.cloud.aws.cache.ElastiCacheFactoryBean.createInstance(ElastiCacheFactoryBean.java:74)
2015-05-29T02:32:35.18-0400 [App / 0] OUT org.springframework.cloud.aws.cache.ElastiCacheFactoryBean.createInstance(ElastiCacheFactoryBean.java:36)
2015-05-29T02:32:35.18-0400 [App / 0] OUT org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:134)