Example usage for org.springframework.context ApplicationContextException ApplicationContextException

List of usage examples for org.springframework.context ApplicationContextException ApplicationContextException

Introduction

In this page you can find the example usage for org.springframework.context ApplicationContextException ApplicationContextException.

Prototype

public ApplicationContextException(String msg, Throwable cause) 

Source Link

Document

Create a new ApplicationContextException with the specified detail message and the given root cause.

Usage

From source file:org.jboss.spring.vfs.context.ContextClassUtil.java

public static Class getVFSWebContextClass() {
    try {/*from   w w  w .j av  a 2s . c o m*/
        return ClassUtils.forName(VFS_APPLICATION_CONTEXT_CLASS_NAME);
    } catch (ClassNotFoundException ex) {
        throw new ApplicationContextException(
                "Failed to load custom context class [" + VFS_APPLICATION_CONTEXT_CLASS_NAME + "]", ex);
    }
}

From source file:de.itsvs.cwtrpc.core.CwtRpcUtils.java

public static void preloadContextClasses(ServletContext servletContext) throws ApplicationContextException {
    final Log log = LogFactory.getLog(CwtRpcUtils.class);
    final String preloadedClasses;

    preloadedClasses = servletContext.getInitParameter(PRELOADED_CLASSES_INIT_PARAM_NAME);
    if (preloadedClasses != null) {
        final String[] classNames = preloadedClasses.split("\\s");

        for (String className : classNames) {
            if (className.length() > 0) {
                if (log.isDebugEnabled()) {
                    log.debug("Preloading class: " + className);
                }//from w  ww  .j  ava  2s.  co m
                try {
                    CwtRpcUtils.class.getClassLoader().loadClass(className);
                } catch (ClassNotFoundException e) {
                    throw new ApplicationContextException("Could not load class '" + className + "'", e);
                }
            }
        }
    }
}

From source file:com.quartzdesk.executor.web.spring.SpringProfilesActivator.java

@Override
public void initialize(XmlWebApplicationContext applicationContext) {
    ConfigurableEnvironment env = applicationContext.getEnvironment();

    WorkDir workDir;/*from   ww  w. j  av a 2 s. com*/
    try {
        workDir = new WorkDir(applicationContext.getServletContext());
    } catch (IOException e) {
        throw new ApplicationContextException("Error obtaining QuartzDesk Executor work directory.", e);
    }

    String databaseProfile = getDatabaseProfile(workDir);

    String[] activeProfiles = new String[] { databaseProfile };

    log.info("Activating Spring profiles: {}", Arrays.toString(activeProfiles));

    env.setActiveProfiles(activeProfiles);
}

From source file:com.sishuok.bigpipe.view.velocity.AbstractVelocityPageletView.java

private VelocityEngine autodetectVelocityEngine() {
    try {/*from w w w .  ja v  a  2  s  . c o  m*/
        VelocityConfig velocityConfig = getApplicationContext().getBean(VelocityConfig.class);
        return velocityConfig.getVelocityEngine();
    } catch (NoSuchBeanDefinitionException ex) {
        throw new ApplicationContextException("please define a VelocityConfig", ex);
    }
}

From source file:org.sakaiproject.util.SakaiApplicationContext.java

/**
 * Load component manager configurations. A more normal hook for this is
 * the "refreshBeanFactory" method, but it's declared final by GenericApplicationContext.
 *//*  w  ww .j av a 2 s .c  om*/
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    super.prepareBeanFactory(beanFactory);
    try {
        loadBeanDefinitions(beanFactory);
    } catch (IOException e) {
        throw new ApplicationContextException(
                "I/O error parsing XML document for application context [" + getDisplayName() + "]", e);
    }
}

From source file:ru.histone.spring.mvc.HistoneView.java

private Histone autodetectHistone() throws BeansException {
    try {//from   w w w.  j  av  a2  s .  c o  m
        HistoneConfig histoneConfig = BeanFactoryUtils.beanOfTypeIncludingAncestors(getApplicationContext(),
                HistoneConfig.class, true, false);
        return histoneConfig.getHistone();
    } catch (NoSuchBeanDefinitionException ex) {
        throw new ApplicationContextException(
                "Must define a single HistoneConfig bean in this web application context "
                        + "(may be inherited): HistoneConfigurer is the usual implementation. "
                        + "This bean may be given any name.",
                ex);
    }
}

From source file:com.gzj.tulip.load.context.RoseAppContext.java

@Override
protected final Resource[] getConfigResources() {
    try {//from w  ww  . ja  v  a2 s .  co  m
        return getConfigResourcesThrowsIOException();
    } catch (IOException e) {
        throw new ApplicationContextException("getConfigResources", e);
    }
}

From source file:com.cisco.dvbu.ps.deploytool.services.ServerManagerImpl.java

public void startServer(String serverId, String pathToServersXML) throws CompositeException {
    String prefix = "startServer";
    // Extract variables for the serverId
    serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);

    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId
                + ", pathToServersXML: " + pathToServersXML);
    }// w w  w.  ja  va 2s. c o m
    try {
        serverManagerAction(ServerDAO.action.START.name(), serverId, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while starting server: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:com.springsource.petclinic.web.menu.MenuLoader.java

/**
 * Calls to {@link #loadMenu()} and set the menu to the {@link ServletContext}
 *//*from www . ja va  2  s. c o m*/
protected void initApplicationContext() throws ApplicationContextException {
    if (!(getApplicationContext() instanceof WebApplicationContext)) {
        return;
    }
    Menu menu;
    try {
        menu = loadMenu();
    } catch (Exception e) {
        throw new ApplicationContextException("Error loading gvNIX web menu", e);
    }
    getServletContext().setAttribute(MENU_SERVLET_CONTEXT_KEY, menu);
}