[英]Java Spring application - Exception sending context initialized event to listener i
I have java spring application which uses spring 3.0.7 with the following spring jars 我有java spring应用程序,它使用spring 3.0.7和以下spring jar
spring-aop-3.0.7.RELEASE.jar 弹簧AOP-3.0.7.RELEASE.jar
spring-asm-3.0.7.RELEASE.jar 弹簧-ASM-3.0.7.RELEASE.jar
spring-beans-3.0.7.RELEASE.jar 弹簧豆,3.0.7.RELEASE.jar
spring-context-3.0.7.RELEASE.jar 弹簧上下文3.0.7.RELEASE.jar
spring-core-3.0.7.RELEASE.jar 弹簧芯3.0.7.RELEASE.jar
spring-data-jdbc-core-1.0.0.RELEASE.jar 弹簧数据JDBC-芯1.0.0.RELEASE.jar
spring-expression-3.0.7.RELEASE.jar 弹簧表达-3.0.7.RELEASE.jar
spring-jdbc-3.0.7.RELEASE.jar 弹簧JDBC-3.0.7.RELEASE.jar
spring-tx-3.0.7.RELEASE.jar 弹簧-TX-3.0.7.RELEASE.jar
spring-web-3.0.7.RELEASE.jar 弹簧网络3.0.7.RELEASE.jar
This application is working fine in many of the VMs. 此应用程序在许多VM中运行良好。 But in one VM it throws the following exception while the server starts up. 但是在一个VM中,它会在服务器启动时抛出以下异常。
Exception sending context initialized event to listener instance of
class org.springframework.web.context.ContextLoaderListener
Any pointers is appreciated. 任何指针都表示赞赏。
Entire exception stacktrace: 整个异常堆栈跟踪:
INFO: Initializing Spring root WebApplicationContext
May 13, 2015 3:28:01 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testCacheLoader': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.util.localization.LoadLocaleMessage com.caching.testCacheLoader.llm; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadLocaleMessage': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.common.dao.CommonDAO com.util.localization.LoadLocaleMessage.commonDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public com.caching.testCache com.common.dao.CommonDAOImpl.testCache; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testCache': Invocation of init method failed; nested exception is com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
@PostConstruct
public void init() {
cache = CacheBuilder.newBuilder().maximumSize(100)
.refreshAfterWrite(8, TimeUnit.HOURS).removalListener(listener)
.build(loader);
ScheduledExecutorService ses = Executors
.newSingleThreadScheduledExecutor();
ses.scheduleWithFixedDelay(new Runnable() {
public void run() {
for (String key : cache.asMap().keySet()) {
cache.refresh(key);
logger.info("Refreshing cache . . . . ");
}
}
}, 0, 5, TimeUnit.MINUTES);
try {
cache.get("LOCALIZATION");
} catch (ExecutionException e) {
e.printStackTrace();
}
}
Look at the last part of the exception: 查看异常的最后一部分:
Error creating bean with name 'testCache':
Invocation of init method failed; nested exception is
com.google.common.util.concurrent.UncheckedExecutionException:
java.lang.NullPointerException
How does the init-method of your testCache
bean look - that's where the fault is (a NullPointerException). testCache
bean的init方法看起来如何 - 这就是故障所在(NullPointerException)。
Cheers, 干杯,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.