Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2075

Error in spring config file reported as a missing config file during initialization of BusApplicationContext

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.4
    • 2.2, 2.1.5
    • Core
    • None

    Description

      The current code to create a Bus in SpringBusFactory masks any problem in processing the spring config file passed in to SpringBusFactory. Currently if a config file is corrupt, the exception thrown trying to process this file is eaten and an attempt to create a Bus is tried again with a different thread context classloader. This completely hides the source of the error and results in a message which indicates that the config file could not be found which is completely misleading for the user.
      The solution is to not perform the 2nd attempt to create a BusApplicationContext and let the original exception propagate upwards.

      private BusApplicationContext createApplicationContext(String cfgFiles[], boolean includeDefaults) {
      try

      { return new BusApplicationContext(cfgFiles, includeDefaults, context); }

      catch (BeansException ex) {
      ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
      if (contextLoader != BusApplicationContext.class.getClassLoader()) {
      Thread.currentThread().setContextClassLoader(
      BusApplicationContext.class.getClassLoader());
      try

      { return new BusApplicationContext(cfgFiles, includeDefaults, context); }

      finally

      { Thread.currentThread().setContextClassLoader(contextLoader); }

      } else

      { throw ex; }

      }
      }

      Attachments

        1. patch.txt
          5 kB
          Seumas Soltysik

        Activity

          People

            Unassigned Unassigned
            seumassoltysik Seumas Soltysik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: