Package org.springframework.context

Examples of org.springframework.context.ApplicationContextException


                LogUtils.log(LOG, Level.INFO, "USER_CFG_FILE_IN_USE", cfgFile);
            } else {
                if (!usingDefault) {
                    LogUtils.log(LOG, Level.WARNING, "USER_CFG_FILE_NOT_LOADED", cfgFile);
                    String message = (new Message("USER_CFG_FILE_NOT_LOADED", LOG, cfgFile)).toString();
                    throw new ApplicationContextException(message);
                }
            }
        }
           
        if (null != cfgFileURLs) {
View Full Code Here


        if (propertyResolver.getProperty("url") == null && propertyResolver.getProperty("databaseName") == null) {
            log.error("Your database connection pool configuration is incorrect! The application" +
                    "cannot start. Please check your Spring profile, current profiles are: {}",
                    Arrays.toString(environment.getActiveProfiles()));

            throw new ApplicationContextException("Database connection pool is not configured correctly");
        }
        HikariConfig config = new HikariConfig();
        config.setDataSourceClassName(propertyResolver.getProperty("dataSourceClassName"));
        if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) {
            config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName"));
View Full Code Here

        Class<?> contextSourceClass;

        try {
            contextSourceClass = ClassUtils.forName(REQUIRED_CONTEXT_SOURCE_CLASS_NAME, ClassUtils.getDefaultClassLoader());
        } catch (ClassNotFoundException e) {
            throw new ApplicationContextException("Couldn't locate: " + REQUIRED_CONTEXT_SOURCE_CLASS_NAME + ". " +
                    " If you are using LDAP with Spring Security, please ensure that you include the spring-ldap " +
                    "jar file in your application", e);
        }

        String[] sources = bf.getBeanNamesForType(contextSourceClass);


        if (sources.length == 0) {
            throw new ApplicationContextException("No BaseLdapPathContextSource instances found. Have you " +
                    "added an <" + Elements.LDAP_SERVER + " /> element to your application context?");
        }

        if (!bf.containsBean(BeanIds.CONTEXT_SOURCE) && defaultNameRequired) {
            if (sources.length > 1) {
                throw new ApplicationContextException("More than one BaseLdapPathContextSource instance found. " +
                        "Please specify a specific server id using the 'server-ref' attribute when configuring your <" +
                        Elements.LDAP_PROVIDER + "> " + "or <" + Elements.LDAP_USER_SERVICE + ">.");
            }

            bf.registerAlias(sources[0], BeanIds.CONTEXT_SOURCE);
View Full Code Here

        if (beans.size() == 0) {
            beans = getBeansOfType(UserDetailsService.class);
        }

        if (beans.size() == 0) {
            throw new ApplicationContextException("No UserDetailsService registered.");

        } else if (beans.size() > 1) {
            throw new ApplicationContextException("More than one UserDetailsService registered. Please " +
                    "use a specific Id reference in <remember-me/> <openid-login/> or <x509 /> elements.");
        }

        return (UserDetailsService) beans.values().toArray()[0];
    }
View Full Code Here

    URL xmlUrl = testClass.getResource(resourceName);
    if ( xmlUrl != null ) {
      xml.loadBeanDefinitions(new UrlResource(xmlUrl));
    } else if ( ctxAnno != null) {
      // is this the appropriate exception here?
      throw new ApplicationContextException("Could not find context file named " + resourceName);
    }
  }
View Full Code Here

                resources.add(cpr);
            } else {
                if (!usingDefault) {
                    LogUtils.log(LOG, Level.WARNING, "USER_CFG_FILE_NOT_LOADED", cfgFile);
                    String message = (new Message("USER_CFG_FILE_NOT_LOADED", LOG, cfgFile)).toString();
                    throw new ApplicationContextException(message);
                } else {
                    LogUtils.log(LOG, Level.INFO, "USER_CFG_FILE_NOT_SPECIFIED_MSG", cfgFile);
                }
            }
        }
View Full Code Here

    try {
      return (FreeMarkerConfig) BeanFactoryUtils
          .beanOfTypeIncludingAncestors(getApplicationContext(),
              FreeMarkerConfig.class, true, false);
    } catch (NoSuchBeanDefinitionException ex) {
      throw new ApplicationContextException(
          "Must define a single FreeMarkerConfig bean in this web application context "
              + "(may be inherited): FreeMarkerConfigurer is the usual implementation. "
              + "This bean may be given any name.", ex);
    }
  }
View Full Code Here

    try {
      // Check that we can get the template, even if we might subsequently
      // get it again.
      getConfiguration().getTemplate(getUrl());
    } catch (ParseException ex) {
      throw new ApplicationContextException(
          "Failed to parse FreeMarker template for URL [" + getUrl()
              + "]", ex);
    } catch (IOException ex) {
      throw new ApplicationContextException(
          "Could not load FreeMarker template for URL [" + getUrl()
              + "]", ex);
    }
  }
View Full Code Here

                LogUtils.log(LOG, Level.INFO, "USER_CFG_FILE_IN_USE", cfgFile);
            } else {
                if (!usingDefault) {
                    LogUtils.log(LOG, Level.WARNING, "USER_CFG_FILE_NOT_LOADED", cfgFile);
                    String message = (new Message("USER_CFG_FILE_NOT_LOADED", LOG, cfgFile)).toString();
                    throw new ApplicationContextException(message);
                }
            }
        }
           
        if (null != cfgFileURLs) {
View Full Code Here

   * @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() + "]");
    }
    return (ConfigurableWebApplicationContext) BeanUtils.instantiateClass(contextClass);
  }
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.