Announcement Announcement Module
Collapse
No announcement yet.
troubleshooting "failed to load applicationcontext", best practices Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • troubleshooting "failed to load applicationcontext", best practices

    -> Is there a guide how to act when you get the dreaded "failed to load applicationcontext"?
    I assume there must be some points in the startup procedure of the Spring framework that are more fruitful than others to check.

    My error log is way too long to interpret.
    -> What should I filter on when troubleshooting this kind of problem?
    -> Is there an article detailing the startup process of Spring?

    I get "failed to load applicationcontext" occasionally also in very simple projects with little code. So far I've had to go back to an earlier version of code and repeat what I did one step at a time. I wish there was a faster method.

    -> How do you guys resolve issues with the symptom "failed to load applicationcontext"?

  • #2
    ...simply follow the stack trace...Spring is always very clear when logging errors...never had any kind of trouble with that...

    Comment


    • #3
      Originally posted by Enrico Pizzi View Post
      ...simply follow the stack trace...Spring is always very clear when logging errors...never had any kind of trouble with that...
      I have had problems getting the useful bits from the stack trace which exactly why I asked for advice what to look for. I also assume this problem often comes from a limited set of typical causes of which several may be commonly known. Which is why I asked.

      Granted, this is because of my limited knowledge of Spring, which I'm trying to expand as fast as I can.

      Comment


      • #4
        I also assume this problem often comes from a limited set of typical causes of which several may be commonly known.
        That's the problem, this assumption is not correct. The context will fail to load for innumerable reasons, 90% are related to a BeanCreationException: the context cannot instantiate one of the beans defined...well potentially every single java Exception can bring to a BeanCreationException, it is something you do wrong in defining the bean, maybe the bean cannot reach external resources (datasource, jms, jndi, filesystem, mail etc) or you just made programming mistakes in its constructor or its init-method, or the bean neeeds another bean which itself has failed to load...and I could go on forever...and there is the remaining 10% of the cases...

        I hope I made myself clear...just follow the stack trace, every time, and the source of the problem ALWAYS comes out.

        Comment


        • #5
          Originally posted by Enrico Pizzi View Post
          That's the problem, this assumption is not correct. The context will fail to load for innumerable reasons, 90% are related to a BeanCreationException: .....and there is the remaining 10% of the cases...

          I hope I made myself clear...just follow the stack trace, every time, and the source of the problem ALWAYS comes out.
          Well, just the the very broad 90% and your suggestion to refocus on the stack trace was very helpful. I need a better log reader I suppose, Netbeans output doesn't quite cut it. I'm going to look for an introductory article on stacktrace analysis too.

          Thanks for your input, Enrico!
          Last edited by MiB; Dec 17th, 2010, 10:09 AM.

          Comment


          • #6
            I need a better log reader I suppose, Netbeans output doesn't quite cut it
            You should learn to use log4j. It's just a matter of putting a jar or the classpath and writing 5-10 lines of a .xml or .properties config file. Once you've done that, activate debug level logging for org.springframework, so that not only errors but also a lot of very useful information on the framework will appear.

            Glad I was of any help.

            Enrico

            Comment

            Working...
            X