Package org.springframework.beans

Examples of org.springframework.beans.FatalBeanException


        logger.debug("Beanset key ... " + beanSetName);

      String beanSetLocation = beanSetMappings.getProperty(beanSetName);

      if (beanSetLocation == null) {
        throw new FatalBeanException("Unable to find methodName for beanset key " + beanSetName);
      }
      location = beanSetLocation;
      element.setAttribute(RESOURCE_ATTRIBUTE, beanSetLocation);
    }
View Full Code Here


    Properties properties = new Properties();
    try {
      properties.load(classLoader.getResourceAsStream(fileName));
    }
    catch (Exception e) {
      throw new FatalBeanException("Unable to load module definition file " + fileName + " on classpath.");
    }
    return properties;
  }
View Full Code Here

    }
    else if (Collection.class.isAssignableFrom(type) && type.isInterface()) {
      Class<?> elementType = descriptor.getCollectionType();
      if (elementType == null) {
        if (descriptor.isRequired()) {
          throw new FatalBeanException("No element type declared for collection [" + type.getName() + "]");
        }
        return null;
      }
      Map<String, Object> matchingBeans = findAutowireCandidates(beanName, elementType, descriptor);
      if (matchingBeans.isEmpty()) {
        if (descriptor.isRequired()) {
          raiseNoSuchBeanDefinitionException(elementType, "collection of " + elementType.getName(), descriptor);
        }
        return null;
      }
      if (autowiredBeanNames != null) {
        autowiredBeanNames.addAll(matchingBeans.keySet());
      }
      TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter());
      return converter.convertIfNecessary(matchingBeans.values(), type);
    }
    else if (Map.class.isAssignableFrom(type) && type.isInterface()) {
      Class<?> keyType = descriptor.getMapKeyType();
      if (keyType == null || !String.class.isAssignableFrom(keyType)) {
        if (descriptor.isRequired()) {
          throw new FatalBeanException("Key type [" + keyType + "] of map [" + type.getName() +
              "] must be assignable to [java.lang.String]");
        }
        return null;
      }
      Class<?> valueType = descriptor.getMapValueType();
      if (valueType == null) {
        if (descriptor.isRequired()) {
          throw new FatalBeanException("No value type declared for map [" + type.getName() + "]");
        }
        return null;
      }
      Map<String, Object> matchingBeans = findAutowireCandidates(beanName, valueType, descriptor);
      if (matchingBeans.isEmpty()) {
View Full Code Here

    else {
      String className = (String) handlerOrClassName;
      try {
        Class<?> handlerClass = ClassUtils.forName(className, this.classLoader);
        if (!NamespaceHandler.class.isAssignableFrom(handlerClass)) {
          throw new FatalBeanException("Class [" + className + "] for namespace [" + namespaceUri +
              "] does not implement the [" + NamespaceHandler.class.getName() + "] interface");
        }
        NamespaceHandler namespaceHandler = (NamespaceHandler) BeanUtils.instantiateClass(handlerClass);
        namespaceHandler.init();
        handlerMappings.put(namespaceUri, namespaceHandler);
        return namespaceHandler;
      }
      catch (ClassNotFoundException ex) {
        throw new FatalBeanException("NamespaceHandler class [" + className + "] for namespace [" +
            namespaceUri + "] not found", ex);
      }
      catch (LinkageError err) {
        throw new FatalBeanException("Invalid NamespaceHandler class [" + className + "] for namespace [" +
            namespaceUri + "]: problem with handler class file or dependent class", err);
      }
    }
  }
View Full Code Here

        logger.debug("Beanset key ... " + beanSetName);

      String beanSetLocation = beanSetMappings.getProperty(beanSetName);

      if (beanSetLocation == null) {
        throw new FatalBeanException("Unable to find methodName for beanset key " + beanSetName);
      }
      location = beanSetLocation;
      element.setAttribute(RESOURCE_ATTRIBUTE, beanSetLocation);
    }
View Full Code Here

    Properties properties = new Properties();
    try {
      properties.load(classLoader.getResourceAsStream(fileName));
    }
    catch (Exception e) {
      throw new FatalBeanException("Unable to load module definition file " + fileName + " on classpath.");
    }
    return properties;
  }
View Full Code Here

    }
    else if (Collection.class.isAssignableFrom(type) && type.isInterface()) {
      Class elementType = descriptor.getCollectionType();
      if (elementType == null) {
        if (descriptor.isRequired()) {
          throw new FatalBeanException("No element type declared for collection [" + type.getName() + "]");
        }
        return null;
      }
      Map<String, Object> matchingBeans = findAutowireCandidates(beanName, elementType, descriptor);
      if (matchingBeans.isEmpty()) {
        if (descriptor.isRequired()) {
          raiseNoSuchBeanDefinitionException(elementType, "collection of " + elementType.getName(), descriptor);
        }
        return null;
      }
      if (autowiredBeanNames != null) {
        autowiredBeanNames.addAll(matchingBeans.keySet());
      }
      TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter());
      return converter.convertIfNecessary(matchingBeans.values(), type);
    }
    else if (Map.class.isAssignableFrom(type) && type.isInterface()) {
      Class keyType = descriptor.getMapKeyType();
      if (keyType == null || !String.class.isAssignableFrom(keyType)) {
        if (descriptor.isRequired()) {
          throw new FatalBeanException("Key type [" + keyType + "] of map [" + type.getName() +
              "] must be assignable to [java.lang.String]");
        }
        return null;
      }
      Class valueType = descriptor.getMapValueType();
      if (valueType == null) {
        if (descriptor.isRequired()) {
          throw new FatalBeanException("No value type declared for map [" + type.getName() + "]");
        }
        return null;
      }
      Map<String, Object> matchingBeans = findAutowireCandidates(beanName, valueType, descriptor);
      if (matchingBeans.isEmpty()) {
View Full Code Here

    ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();

    try {
      Resource[] configResources = resourcePatternResolver.getResources(resourceLocation);
      if (configResources.length == 0) {
        throw new FatalBeanException("Unable to find resource for specified definition. " +
            "Group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]");
      }
      reader.loadBeanDefinitions(configResources);
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException(
          "Error accessing bean definition resource [" + this.resourceLocation + "]", ex);
    }
    catch (BeanDefinitionStoreException ex) {
      throw new FatalBeanException("Unable to load group definition: " +
          "group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]", ex);
    }

    return factory;
  }
View Full Code Here

    else {
      String className = (String) handlerOrClassName;
      try {
        Class<?> handlerClass = ClassUtils.forName(className, this.classLoader);
        if (!NamespaceHandler.class.isAssignableFrom(handlerClass)) {
          throw new FatalBeanException("Class [" + className + "] for namespace [" + namespaceUri +
              "] does not implement the [" + NamespaceHandler.class.getName() + "] interface");
        }
        NamespaceHandler namespaceHandler = (NamespaceHandler) BeanUtils.instantiateClass(handlerClass);
        namespaceHandler.init();
        handlerMappings.put(namespaceUri, namespaceHandler);
        return namespaceHandler;
      }
      catch (ClassNotFoundException ex) {
        throw new FatalBeanException("NamespaceHandler class [" + className + "] for namespace [" +
            namespaceUri + "] not found", ex);
      }
      catch (LinkageError err) {
        throw new FatalBeanException("Invalid NamespaceHandler class [" + className + "] for namespace [" +
            namespaceUri + "]: problem with handler class file or dependent class", err);
      }
    }
  }
View Full Code Here

                        plus++;
                        minus++;
                    }
                }
                catch (Throwable ex) {
                    FatalBeanException errorVar = new FatalBeanException("DisplayNode: Could not compare properties from source", ex);
                    ErrorMgr.addError(errorVar);
                    throw errorVar;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.springframework.beans.FatalBeanException

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.