Announcement Announcement Module
Collapse
No announcement yet.
Bean Factory prematurely closing under Tomcat with Struts Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bean Factory prematurely closing under Tomcat with Struts

    I have a Struts/Spring/Hibernate web app that loads its configuration using commons Digestor.

    I created a bean that accepts a filename as a bean property, creates a Digestor instance, cnofigures it, and then parses the file.

    This process works quite well in testing when I run standalone and without Tomcat. However, when I try to start up under Tomcat, something strange happens. Take a look at the log :

    Code:
    2584 DEBUG com.acs.test.configuration.EJConfigurationBean | Configuration being loaded
    2584 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | load()
    2594 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | dtdURL set to: 'file:/D:/tomcat/work/Catalina/localhost/ej/loader/com/acs/test/configuration/resources/config.dtd'
    2594 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | mapping file found : 'D:\tomcat\webapps\ej\WEB-INF\classes\config.xml'
    2594 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | parse()
    2624 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | setting validation to : true
    2624 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | pushing top level object
    2624 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | configuring the digestor
    2624 DEBUG com.acs.test.configuration.impl.EJConfigurationLoaderDigestor | configureEmailPortion()
    2634 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory | Destroying singletons in factory {org.springframework.beans.factory.support.DefaultLista
    bleBeanFactory defining beans [dataSource,sessionFactory,transactionManager,fileLocator,configurationLoader,config,votersDAO,poolDAO,bioformDAO,poolWebDAO,lookUpDAO,baseD
    AO,defLettDAO,transactionService,objectCreationFactory,ejMappingRuleSet,bioformMappingService,bioformDataService,questionDataService,webDateFormatter,partHistoryFactory,l
    ogInTrackingService,holidayDataService,personalInfoDataService,statusDataService,deferDataService,webParticipantService,securityService,emailService,participantMessagingS
    ervice]; Root of BeanFactory hierarchy}
    2634 INFO  org.springframework.orm.hibernate.LocalSessionFactoryBean | Closing Hibernate SessionFactory
    2634 INFO  net.sf.hibernate.impl.SessionFactoryImpl | closing
    2634 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory | Destroying inner beans in factory {org.springframework.beans.factory.support.DefaultList
    ableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,fileLocator,configurationLoader,config,votersDAO,poolDAO,bioformDAO,poolWebDAO,lookUpDAO,base
    DAO,defLettDAO,transactionService,objectCreationFactory,ejMappingRuleSet,bioformMappingService,bioformDataService,questionDataService,webDateFormatter,partHistoryFactory,
    logInTrackingService,holidayDataService,personalInfoDataService,statusDataService,deferDataService,webParticipantService,securityService,emailService,participantMessaging
    Service]; Root of BeanFactory hierarchy}
    2634 ERROR org.springframework.web.context.ContextLoader | Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in resource [/WEB-INF/conf/spring/applicationContext.xml] of Servl
    etContext: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.apache.commons.digester.Digester.addSetNestedProperties(Ljava/lang/String;)
    V
    java.lang.NoSuchMethodError: org.apache.commons.digester.Digester.addSetNestedProperties(Ljava/lang/String;)V
            at com.acs.test.configuration.impl.EJConfigurationLoaderDigestor.configureEmail(EJConfigurationLoaderDigestor.java:163)
            at com.acs.test.configuration.impl.EJConfigurationLoaderDigestor.configureDigester(EJConfigurationLoaderDigestor.java:134)
            at com.acs.test.configuration.impl.EJConfigurationLoaderDigestor.parse(EJConfigurationLoaderDigestor.java:123)
            at com.acs.test.configuration.impl.EJConfigurationLoaderDigestor.load(EJConfigurationLoaderDigestor.java:87)
            at com.acs.test.configuration.EJConfigurationBean.init(EJConfigurationBean.java:64)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1087)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1061)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:287)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:205)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:235)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284)
            at org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:131)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:156)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:97)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
            at org.apache.catalina.core.StandardService.start(StandardService.java:480)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
    Apr 13, 2005 4:35:23 PM org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    Apr 13, 2005 4:35:23 PM org.apache.catalina.core.StandardContext start
    SEVERE: Context startup failed due to previous errors
    I have run the application withought this bean (loading a default context w/o digestor) and all works well. I have run this exact setup in JUnit as a standalone application and all works well. Something seems to happen when I run under Tomcat that makes the low level DefaultListableBeanFactory start stutting itself down. I've scowered the logs, but can't find anything that would indicate what's happening.

    Does anyone have a clue?

  • #2
    Looks like the Commons Digester version that Tomcat ships is older than the one you are compiling against. A NoSuchMethodError always indicates a mismatch in library versions, between compilation and deployment.

    Juergen

    Comment


    • #3
      nice

      Good call. I compiled with the one in my IDE and then the one in my web app was older.. Thanks a bunch!

      Comment

      Working...
      X