Announcement Announcement Module
Collapse
No announcement yet.
[org.springframwork.web.servlet.DispatcherServlet] Context initialization failed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [org.springframwork.web.servlet.DispatcherServlet] Context initialization failed

    1. Symptom

    An application runs fine when deployed to Tomcat 6 (or Tomcat 7) on Windows.
    But, when the application is deployed to Tomcat 6 (or Tomcat 7) on AIX (environment described in 'item 2' above),
    it does not run and I see the tomcat error messages as below.

    2. Error message in Tomcat's error log

    (1) Error message type 1
    [org.springframwork.web.servlet.DispatcherServlet] Context initialization failed

    (2) Error message type 2
    org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'sampleFileUploadService' is defined

    org.springframework.beans.factory.nosuchbeandefini tionexception no bean named is defined


    3. 'sampleFileUploadService' is defined in the source code as below:

    @Service("sampleFileUploadService")
    public class myappSampleFileUploadserviceImpl implements myappSampleFileUploadservice {
    ....
    ...
    }


    4. Development and Production Environment

    4.1 Development Environment

    (1) Hardware: PC
    (2) OS: Win Server 2003
    (3) JDK: Sun JDK 1.6.0
    (4) Spring Framwwork v. 3.0.5
    (5) Tomcat 6
    (6) Oracle 11g Database


    4.2 Production Server Environment

    (1) Hardware: IBM PA7
    (2) OS: AIX 6.0
    (3) JDK: IBM JDK 1.6.0
    (4) Tomcat 6
    (5) Oracle 11g Database


    5. Questions

    (1) Why does the 'org.springframwork.web.servlet.DispatcherServlet' initialization failure problem occur only on AIX, not on Windows? How can I fix the problem?

    (2) The service 'sampleFileUploadService' is defined in the source code and Tomcat can find the service at run time on Windows. But, Tomcat can not find the service (service defined using the '@Service' annotation) on AIX.
    What is the reason this problem occurs only on AIX, not on Windows? How can I fix the problem?

    If anyone experienced the same problem and solved it, I'd appreciate it if you could share the solution.

    - Hoon -

  • #2
    Post the full stacktrace instead of only the message.

    Different environments, especially with different JDKs, can lead to suprising differences (wouldn't be the first time I ran into issues when switching from Sun to IBM).

    Comment


    • #3
      Here is the full stack trace:

      You can find the following error messages in the stack:
      (1) [org.springframework.web.servlet.DispatcherServlet] Context initialization failed

      (2)org.springframework.beans.factory.NoSuchBeanDef initionException: No bean named 'sampleFileUploadService' is defined



      2013-01-09 16:01:53,805 ERROR [org.springframework.web.servlet.DispatcherServlet] Context initialization failed
      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'apmsSampleFileUploadController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'sampleFileUploadService' is defined
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.postProcessPropertyValues(C ommonAnnotationBeanPostProcessor.java:300)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1074)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
      at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:580)
      at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
      at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 42)
      at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 58)
      at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:339 )
      at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:306)
      at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
      at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
      at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1206)
      at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:1026)
      at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4421)
      at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4734)
      at org.apache.catalina.startup.HostConfig.checkResour ces(HostConfig.java:1284)
      at org.apache.catalina.startup.HostConfig.check(HostC onfig.java:1382)
      at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:306)
      at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.backgroundP rocess(ContainerBase.java:1389)
      at org.apache.catalina.core.ContainerBase$ContainerBa ckgroundProcessor.processChildren(ContainerBase.ja va:1653)
      at org.apache.catalina.core.ContainerBase$ContainerBa ckgroundProcessor.processChildren(ContainerBase.ja va:1662)
      at org.apache.catalina.core.ContainerBase$ContainerBa ckgroundProcessor.run(ContainerBase.java:1642)
      at java.lang.Thread.run(Thread.java:736)
      Caused by:
      org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'sampleFileUploadService' is defined
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:527)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedLocalBeanDefinition(AbstractB eanFactory.java:1083)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:274 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:266 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.autowireResource(CommonAnno tationBeanPostProcessor.java:435)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.getResource(CommonAnnotatio nBeanPostProcessor.java:409)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor$ResourceElement.getResource ToInject(CommonAnnotationBeanPostProcessor.java:54 1)
      at org.springframework.beans.factory.annotation.Injec tionMetadata$InjectedElement.inject(InjectionMetad ata.java:147)
      at org.springframework.beans.factory.annotation.Injec tionMetadata.inject(InjectionMetadata.java:84)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.postProcessPropertyValues(C ommonAnnotationBeanPostProcessor.java:297)
      ... 29 more
      Root cause follows.
      org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'sampleFileUploadService' is defined
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:527)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedLocalBeanDefinition(AbstractB eanFactory.java:1083)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:274 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:266 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.autowireResource(CommonAnno tationBeanPostProcessor.java:435)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.getResource(CommonAnnotatio nBeanPostProcessor.java:409)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor$ResourceElement.getResource ToInject(CommonAnnotationBeanPostProcessor.java:54 1)
      at org.springframework.beans.factory.annotation.Injec tionMetadata$InjectedElement.inject(InjectionMetad ata.java:147)
      at org.springframework.beans.factory.annotation.Injec tionMetadata.inject(InjectionMetadata.java:84)
      at org.springframework.context.annotation.CommonAnnot ationBeanPostProcessor.postProcessPropertyValues(C ommonAnnotationBeanPostProcessor.java:297)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1074)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
      at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:580)
      at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
      at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 42)
      at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 58)
      at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:339 )
      at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:306)
      at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
      at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
      at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1206)
      at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:1026)
      at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4421)
      at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4734)
      at org.apache.catalina.startup.HostConfig.checkResour ces(HostConfig.java:1284)
      at org.apache.catalina.startup.HostConfig.check(HostC onfig.java:1382)
      at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:306)
      at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.backgroundP rocess(ContainerBase.java:1389)
      at org.apache.catalina.core.ContainerBase$ContainerBa ckgroundProcessor.processChildren(ContainerBase.ja va:1653)
      at org.apache.catalina.core.ContainerBase$ContainerBa ckgroundProcessor.processChildren(ContainerBase.ja va:1662)
      at org.apache.catalina.core.ContainerBase$ContainerBa ckgroundProcessor.run(ContainerBase.java:1642)
      Last edited by hoonppark; Jan 13th, 2013, 08:46 PM.

      Comment


      • #4
        I've solved my own problem.

        It turns out that there is a service named 'sampleFileUploadService' which is not used by any module. I guess it is not properly defined. The solution in my case is deleting that service related directory and files. I deleted $tomcat_home/.../rte/samplefileupload/ directory and the system began to work fine on AIX.

        A strange thing in this case was the application ran fine on Windows (Tomcat 7) even with the "sampleFileUploadService" service which is not properly defined. But, the same application created a problem on Unix (Tomcat 7).

        - Hoon -

        Comment

        Working...
        X