Announcement Announcement Module
Collapse
No announcement yet.
ClassPathXmlApplicationContext: Publishing event then hangs! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassPathXmlApplicationContext: Publishing event then hangs!

    Hi all,

    We've recently deployed an app that works well in our staging environments. However, once deployed to the client production environment we have issues starting the application.

    While in debug mode, it appears that the ClassPathXmlApplicationContext hangs upon "publishing event in context." I've provided the DEBUG log output below.

    As in our staging environment we're expecting the cached instance of singleton bean 'serviceMonitorApplication' to be returned. Instead the application hangs.

    Any clues on how to debug this? Anything suspicious in the DEBUG log?

    Application context (trayContext.xml):

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE beans PUBLIC
        "-//SPRING//DTD BEAN//EN"
        "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <beans
      default-autowire="no"
      default-lazy-init="false"
      default-dependency-check="none"
    >
    
    	<bean id="serviceMonitorApplication" class="com.acme.client.application.HighlightServiceMonitorApplication" destroy-method="close">
    		<property name="highlightService" ref="highlightService"/>	    
        </bean>
        <bean id="highlightService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
            <property name="serviceUrl" value="rmi&#58;//localhost&#58;1199/HighlightService"/>
            <property name="serviceInterface" value="com.acme.application.IApplicationService"/>
            <property name="lookupStubOnStartup"><value>false</value></property>
            <property name="refreshStubOnConnectFailure"><value>true</value></property>
        </bean>
    
    </beans>
    DEBUG log:

    Code:
    2005-07-29 11&#58;42&#58;01,359 INFO &#91;org.springframework.beans.factory.xml.XmlBeanDefinitionReader&#93; - <Loading XML bean definitions from class path resource &#91;trayContext.xml&#93;>
    2005-07-29 11&#58;42&#58;01,359 DEBUG &#91;org.springframework.beans.factory.xml.XmlBeanDefinitionReader&#93; - <Using JAXP implementation &#91;org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@a6d51e&#93;>
    2005-07-29 11&#58;42&#58;01,390 DEBUG &#91;org.springframework.beans.factory.xml.ResourceEntityResolver&#93; - <Trying to resolve XML entity with public ID &#91;-//SPRING//DTD BEAN//EN&#93; and system ID &#91;http&#58;//www.springframework.org/dtd/spring-beans.dtd&#93;>
    2005-07-29 11&#58;42&#58;01,390 DEBUG &#91;org.springframework.beans.factory.xml.ResourceEntityResolver&#93; - <Trying to locate &#91;spring-beans.dtd&#93; under &#91;/org/springframework/beans/factory/xml/&#93;>
    2005-07-29 11&#58;42&#58;01,390 DEBUG &#91;org.springframework.beans.factory.xml.ResourceEntityResolver&#93; - <Found beans DTD &#91;http&#58;//www.springframework.org/dtd/spring-beans.dtd&#93; in classpath>
    2005-07-29 11&#58;42&#58;01,437 DEBUG &#91;org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser&#93; - <Loading bean definitions>
    2005-07-29 11&#58;42&#58;01,437 DEBUG &#91;org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser&#93; - <Default lazy init 'false'>
    2005-07-29 11&#58;42&#58;01,437 DEBUG &#91;org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser&#93; - <Default dependency check 'none'>
    2005-07-29 11&#58;42&#58;01,437 DEBUG &#91;org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser&#93; - <Default autowire 'no'>
    2005-07-29 11&#58;42&#58;01,531 DEBUG &#91;org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser&#93; - <Found 2 <bean> elements defining beans>
    2005-07-29 11&#58;42&#58;01,531 INFO &#91;org.springframework.context.support.ClassPathXmlApplicationContext&#93; - <Bean factory for application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=29147324&#93;&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;serviceMonitorApplication,highlightService&#93;; root of BeanFactory hierarchy>
    2005-07-29 11&#58;42&#58;01,546 INFO &#91;org.springframework.context.support.ClassPathXmlApplicationContext&#93; - <2 beans defined in application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=29147324&#93;>
    2005-07-29 11&#58;42&#58;01,562 INFO &#91;org.springframework.core.CollectionFactory&#93; - <JDK 1.4+ collections available>
    2005-07-29 11&#58;42&#58;01,562 DEBUG &#91;org.springframework.core.CollectionFactory&#93; - <Creating java.util.LinkedHashMap>
    2005-07-29 11&#58;42&#58;01,562 INFO &#91;org.springframework.context.support.ClassPathXmlApplicationContext&#93; - <Unable to locate MessageSource with name 'messageSource'&#58; using default &#91;[email protected]4&#93;>
    2005-07-29 11&#58;42&#58;01,562 INFO &#91;org.springframework.context.support.ClassPathXmlApplicationContext&#93; - <Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster'&#58; using default &#91;org.springframework.context.event.SimpleApplicationEventMulticaster@1a62c31&#93;>
    2005-07-29 11&#58;42&#58;01,562 DEBUG &#91;org.springframework.core.CollectionFactory&#93; - <Creating java.util.LinkedHashMap>
    2005-07-29 11&#58;42&#58;01,562 INFO &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Pre-instantiating singletons in factory &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;serviceMonitorApplication,highlightService&#93;; root of BeanFactory hierarchy&#93;>
    2005-07-29 11&#58;42&#58;01,578 INFO &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Creating shared instance of singleton bean 'serviceMonitorApplication'>
    2005-07-29 11&#58;42&#58;01,578 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Creating instance of bean 'serviceMonitorApplication' with merged definition &#91;Root bean with class &#91;com.acme.client.application.HighlightServiceMonitorApplication&#93; defined in class path resource &#91;trayContext.xml&#93;&#93;>
    2005-07-29 11&#58;42&#58;01,578 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking BeanPostProcessors before instantiation of bean 'serviceMonitorApplication'>
    2005-07-29 11&#58;42&#58;01,609 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Getting BeanInfo for class &#91;com.acme.client.application.HighlightServiceMonitorApplication&#93;>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Caching PropertyDescriptors for class &#91;com.acme.client.application.HighlightServiceMonitorApplication&#93;>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'applicationContext' of type &#91;org.springframework.context.ApplicationContext&#93;>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'highlightService' of type &#91;com.acme.application.IApplicationService&#93;>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'services' of type &#91;com.acme.client.application.ApplicationServices&#93;>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'class' of type &#91;java.lang.Class&#93;>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Class &#91;com.acme.client.application.HighlightServiceMonitorApplication&#93; is cache-safe>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.factory.support.BeanDefinitionValueResolver&#93; - <Resolving reference from property 'highlightService' in bean 'serviceMonitorApplication' to bean 'highlightService'>
    2005-07-29 11&#58;42&#58;01,625 INFO &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Creating shared instance of singleton bean 'highlightService'>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Creating instance of bean 'highlightService' with merged definition &#91;Root bean with class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93; defined in class path resource &#91;trayContext.xml&#93;&#93;>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking BeanPostProcessors before instantiation of bean 'highlightService'>
    2005-07-29 11&#58;42&#58;01,625 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Getting BeanInfo for class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Caching PropertyDescriptors for class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'object' of type &#91;java.lang.Object&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'cacheStub' of type &#91;boolean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'serviceInterface' of type &#91;java.lang.Class&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'class' of type &#91;java.lang.Class&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'singleton' of type &#91;boolean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'remoteInvocationFactory' of type &#91;org.springframework.remoting.support.RemoteInvocationFactory&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'objectType' of type &#91;java.lang.Class&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'lookupStubOnStartup' of type &#91;boolean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'refreshStubOnConnectFailure' of type &#91;boolean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Found property 'serviceUrl' of type &#91;java.lang.String&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.CachedIntrospectionResults&#93; - <Class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93; is cache-safe>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <About to invoke write method &#91;public void org.springframework.remoting.support.UrlBasedRemoteAccessor.setServiceUrl&#40;java.lang.String&#41;&#93; on object of class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Invoked write method &#91;public void org.springframework.remoting.support.UrlBasedRemoteAccessor.setServiceUrl&#40;java.lang.String&#41;&#93; with value of type &#91;java.lang.String&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Converting String to &#91;class java.lang.Class&#93; using property editor &#91;org.springframework.beans.propertyeditors.ClassEditor@64883c&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <About to invoke write method &#91;public void org.springframework.remoting.support.RemoteAccessor.setServiceInterface&#40;java.lang.Class&#41;&#93; on object of class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Invoked write method &#91;public void org.springframework.remoting.support.RemoteAccessor.setServiceInterface&#40;java.lang.Class&#41;&#93; with value of type &#91;java.lang.Class&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Converting String to &#91;boolean&#93; using property editor &#91;[email protected]e6b&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <About to invoke write method &#91;public void org.springframework.remoting.rmi.RmiClientInterceptor.setLookupStubOnStartup&#40;boolean&#41;&#93; on object of class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Invoked write method &#91;public void org.springframework.remoting.rmi.RmiClientInterceptor.setLookupStubOnStartup&#40;boolean&#41;&#93; with value of type &#91;boolean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Converting String to &#91;boolean&#93; using property editor &#91;[email protected]e6b&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <About to invoke write method &#91;public void org.springframework.remoting.rmi.RmiClientInterceptor.setRefreshStubOnConnectFailure&#40;boolean&#41;&#93; on object of class &#91;org.springframework.remoting.rmi.RmiProxyFactoryBean&#93;>
    2005-07-29 11&#58;42&#58;01,656 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Invoked write method &#91;public void org.springframework.remoting.rmi.RmiClientInterceptor.setRefreshStubOnConnectFailure&#40;boolean&#41;&#93; with value of type &#91;boolean&#93;>
    2005-07-29 11&#58;42&#58;01,671 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking BeanPostProcessors before initialization of bean 'highlightService'>
    2005-07-29 11&#58;42&#58;01,671 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking afterPropertiesSet&#40;&#41; on bean with name 'highlightService'>
    2005-07-29 11&#58;42&#58;01,812 INFO &#91;org.springframework.aop.framework.DefaultAopProxyFactory&#93; - <CGLIB2 available&#58; proxyTargetClass feature enabled>
    2005-07-29 11&#58;42&#58;01,812 DEBUG &#91;org.springframework.core.CollectionFactory&#93; - <Creating java.util.IdentityHashMap>
    2005-07-29 11&#58;42&#58;01,812 DEBUG &#91;org.springframework.aop.framework.ProxyFactory&#93; - <Added new aspect interface&#58; com.acme.application.IApplicationService>
    2005-07-29 11&#58;42&#58;01,812 DEBUG &#91;org.springframework.aop.framework.JdkDynamicAopProxy&#93; - <Creating JDK dynamic proxy>
    2005-07-29 11&#58;42&#58;01,843 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking BeanPostProcessors after initialization of bean 'highlightService'>
    2005-07-29 11&#58;42&#58;01,843 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Bean with name 'highlightService' is a factory bean>
    2005-07-29 11&#58;42&#58;01,843 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <About to invoke write method &#91;public void com.acme.client.application.HighlightServiceMonitorApplication.setHighlightService&#40;com.acme.application.IApplicationService&#41;&#93; on object of class &#91;com.acme.client.application.HighlightServiceMonitorApplication&#93;>
    2005-07-29 11&#58;42&#58;01,843 DEBUG &#91;org.springframework.beans.BeanWrapperImpl&#93; - <Invoked write method &#91;public void com.acme.client.application.HighlightServiceMonitorApplication.setHighlightService&#40;com.acme.application.IApplicationService&#41;&#93; with value of type &#91;com.acme.application.IApplicationService&#93;>
    2005-07-29 11&#58;42&#58;01,843 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking BeanPostProcessors before initialization of bean 'serviceMonitorApplication'>
    2005-07-29 11&#58;42&#58;01,843 DEBUG &#91;org.springframework.context.support.ApplicationContextAwareProcessor&#93; - <Invoking setApplicationContext on ApplicationContextAware bean 'serviceMonitorApplication'>
    2005-07-29 11&#58;42&#58;01,859 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking afterPropertiesSet&#40;&#41; on bean with name 'serviceMonitorApplication'>
    2005-07-29 11&#58;42&#58;01,859 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Invoking BeanPostProcessors after initialization of bean 'serviceMonitorApplication'>
    2005-07-29 11&#58;42&#58;01,859 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Returning cached instance of singleton bean 'highlightService'>
    2005-07-29 11&#58;42&#58;01,859 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Calling code asked for FactoryBean instance for name 'highlightService'>
    2005-07-29 11&#58;42&#58;01,859 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Returning cached instance of singleton bean 'highlightService'>
    2005-07-29 11&#58;42&#58;01,859 DEBUG &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory&#93; - <Bean with name 'highlightService' is a factory bean>
    2005-07-29 11&#58;42&#58;01,859 DEBUG &#91;org.springframework.context.support.ClassPathXmlApplicationContext&#93; - <Publishing event in context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=29147324&#93;&#58; org.springframework.context.event.ContextRefreshedEvent&#91;source=org.springframework.context.support.ClassPathXmlApplicationContext&#58; display name &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=29147324&#93;; startup date &#91;Fri Jul 29 11&#58;42&#58;01 EDT 2005&#93;; root of context hierarchy&#93;>

  • #2
    Is your code trying to connect to something which is hanging? I don't think events are asynchronous (guessing ) so if the event receiver hangs, so will the container.

    Just a guess

    What does your event receiver look like, does that produce any debug?

    Comment


    • #3
      Strangeness...

      Upon further review, I believe the ClassPathXmlApplicationContext is creating itself successfully. What seems to be the problem is when I try to retrieve the serviceMonitorApplication bean (see trayContext.xml below).

      For some reason it just hangs when I try to retrieve the HighlightServiceMonitorApplication bean via this code:

      Code:
      HighlightServiceMonitorApplication application = &#40;HighlightServiceMonitorApplication&#41; applicationContext.getBean&#40;"serviceMonitorApplication"&#41;;
      As I said earlier this code works on our staging and testing servers. This bean also contains highlightService an RmiProxyFactoryBean pointing to a service on the localhost. I thought initially that possibly this was a connection issue, however, I'd imagine that if it were a RemoteLookupFailureException would be thrown. However, it doesn't, it just hangs there.

      Could my RmiProxyFactoryBean in fact be the culprit?

      Please advise.

      Thanks,
      Roll


      trayContext.xml


      Code:
         <bean id="serviceMonitorApplication" class="com.acme.client.application.HighlightServiceMonitorApplication" destroy-method="close">
            <property name="highlightService" ref="highlightService"/>      
          </bean>
          <bean id="highlightService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
              <property name="serviceUrl" value="rmi&#58;//localhost&#58;1199/HighlightService"/>
              <property name="serviceInterface" value="com.acme.application.IApplicationService"/>
              <property name="lookupStubOnStartup"><value>false</value></property>
              <property name="refreshStubOnConnectFailure"><value>true</value></property>
          </bean>

      Comment


      • #4
        I should also mention that if a RemoteLookupFailureException in fact be thrown, we would have catched and logged it.

        Comment


        • #5
          As far as I can tell, both serviceMonitorApplication and highlightService (the RmiPRoxyFactoryBean) are being created ok. They are singletons, which get pre-instantiated by default, and the logging output shows that that is actually happening. This would be before the programmatic getBean() call.

          Are you quite sure you're getting a hang on the actual getBean() call itself?

          Comment


          • #6
            Hi Colin,

            Thanks for the response. Yes, I can confirm that it is hanging on the getBean call.

            I had the system administrator relax some settings on the firewall to allow inbound/outbound on the RMI port. Today it seems that all is working fine and I can retrieve the bean.

            Still puzzled however why if it was in fact a port issue didn't it throw RemoteLookupFailureException and retry instead of just hanging there.

            I'm going to continue to investigate but any thoughts you might have would greatly be appreciated.

            Thanks,
            Roll

            Comment

            Working...
            X