Package org.springframework.context

Examples of org.springframework.context.ApplicationContextException


   * @see ConfigurableWebApplicationContext
   */
  protected WebApplicationContext createWebApplicationContext(ServletContext sc) {
    Class<?> contextClass = determineContextClass(sc);
    if (!ConfigurableWebApplicationContext.class.isAssignableFrom(contextClass)) {
      throw new ApplicationContextException("Custom context class [" + contextClass.getName() +
          "] is not of type [" + ConfigurableWebApplicationContext.class.getName() + "]");
    }
    ConfigurableWebApplicationContext wac =
        (ConfigurableWebApplicationContext) BeanUtils.instantiateClass(contextClass);
    return wac;
View Full Code Here


    if (contextClassName != null) {
      try {
        return ClassUtils.forName(contextClassName, ClassUtils.getDefaultClassLoader());
      }
      catch (ClassNotFoundException ex) {
        throw new ApplicationContextException(
            "Failed to load custom context class [" + contextClassName + "]", ex);
      }
    }
    else {
      contextClassName = defaultStrategies.getProperty(WebApplicationContext.class.getName());
      try {
        return ClassUtils.forName(contextClassName, ContextLoader.class.getClassLoader());
      }
      catch (ClassNotFoundException ex) {
        throw new ApplicationContextException(
            "Failed to load default context class [" + contextClassName + "]", ex);
      }
    }
  }
View Full Code Here

          Assert.isAssignable(ApplicationContextInitializer.class, clazz,
              "class [" + className + "] must implement ApplicationContextInitializer");
          classes.add((Class<ApplicationContextInitializer<ConfigurableApplicationContext>>)clazz);
        }
        catch (ClassNotFoundException ex) {
          throw new ApplicationContextException(
              "Failed to load context initializer class [" + className + "]", ex);
        }
      }
    }
    return classes;
View Full Code Here

            MBeanServer server = ManagementFactory.getPlatformMBeanServer();
            server.registerMBean(new LiveBeansView(),
                new ObjectName(mbeanDomain, MBEAN_APPLICATION_KEY, applicationContext.getApplicationName()));
          }
          catch (Exception ex) {
            throw new ApplicationContextException("Failed to register LiveBeansView MBean", ex);
          }
        }
        applicationContexts.add(applicationContext);
      }
    }
View Full Code Here

          MBeanServer server = ManagementFactory.getPlatformMBeanServer();
          String mbeanDomain = applicationContext.getEnvironment().getProperty(MBEAN_DOMAIN_PROPERTY_NAME);
          server.unregisterMBean(new ObjectName(mbeanDomain, MBEAN_APPLICATION_KEY, applicationContext.getApplicationName()));
        }
        catch (Exception ex) {
          throw new ApplicationContextException("Failed to unregister LiveBeansView MBean", ex);
        }
      }
    }
  }
View Full Code Here

      synchronized (this.beanFactoryMonitor) {
        this.beanFactory = beanFactory;
      }
    }
    catch (IOException ex) {
      throw new ApplicationContextException("I/O error parsing bean definition source for " + getDisplayName(), ex);
    }
  }
View Full Code Here

    this.report = loadReport();

    // Load sub reports if required, and check data source parameters.
    if (this.subReportUrls != null) {
      if (this.subReportDataKeys != null && this.subReportDataKeys.length > 0 && this.reportDataKey == null) {
        throw new ApplicationContextException(
            "'reportDataKey' for main report is required when specifying a value for 'subReportDataKeys'");
      }
      this.subReports = new HashMap<String, JasperReport>(this.subReportUrls.size());
      for (Enumeration urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) {
        String key = (String) urls.nextElement();
View Full Code Here

      }
      throw new IllegalArgumentException(
          "Report filename [" + filename + "] must end in either .jasper or .jrxml");
    }
    catch (IOException ex) {
      throw new ApplicationContextException(
          "Could not load JasperReports report from " + resource, ex);
    }
    catch (JRException ex) {
      throw new ApplicationContextException(
          "Could not parse JasperReports report from " + resource, ex);
    }
  }
View Full Code Here

        }
        try {
          bean.start();
        }
        catch (Throwable ex) {
          throw new ApplicationContextException("Failed to start bean '" + beanName + "'", ex);
        }
        if (logger.isDebugEnabled()) {
          logger.debug("Successfully started bean '" + beanName + "'");
        }
      }
View Full Code Here

      this.logger.debug("Servlet with name '" + getServletName() +
          "' will try to create custom WebApplicationContext context of class '" +
          contextClass.getName() + "'" + ", using parent context [" + parent + "]");
    }
    if (!ConfigurableWebApplicationContext.class.isAssignableFrom(contextClass)) {
      throw new ApplicationContextException(
          "Fatal initialization error in servlet with name '" + getServletName() +
          "': custom WebApplicationContext class [" + contextClass.getName() +
          "] is not of type ConfigurableWebApplicationContext");
    }
    ConfigurableWebApplicationContext wac =
View Full Code Here

TOP

Related Classes of org.springframework.context.ApplicationContextException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.