简体   繁体   English

Java Spring应用程序 - 将上下文初始化事件发送给侦听器i的异常

[英]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.

相关问题 SEVERE:将上下文初始化事件发送到侦听器实例的异常 - SEVERE: Exception sending context initialized event to listener instance 异常将上下文初始化事件发送到类的侦听器实例 - exception sending context initialized event to listener instance of class 异常将上下文初始化事件发送到类 org.springframework.web.context.ContextLoaderListener 的侦听器实例 - Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener Resteasy例外; 将上下文初始化事件发送到类ResteasyBootstrap的侦听器实例的异常 - Resteasy Exception; Exception sending context initialized event to listener instance of class ResteasyBootstrap GlassFish重新启动-现在将异常发送上下文初始化事件发送给类的侦听器实例 - GlassFish restart - Now getting Exception sending context initialized event to listener instance of class 向类org.springframework.web.context.request.RequestContextListener的侦听器实例发送请求初始化的生命周期事件的异常 - Exception sending request initialized lifecycle event to listener instance of class org.springframework.web.context.request.RequestContextListener 将上下文初始化事件发送到类org.apache.tomcat.websocket.server.WsContextListener的侦听器实例的异常 - Exception sending context initialized event to listener instance of class org.apache.tomcat.websocket.server.WsContextListener 将上下文初始化事件发送到类org.springframework.web.context.ContextLoaderListener的侦听器实例时出错 - Error sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.ExceptionInInitializerError在Spring中创建应用程序上下文时的异常 - java.lang.ExceptionInInitializerError Exception when creating Application Context in Spring 使用上下文层次结构子上下文bean作为应用程序侦听器的Spring集成测试 - Spring integration test with context hierarchy child context bean as application listener
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM