Package org.springframework.beans

Examples of org.springframework.beans.FatalBeanException


         ClassLoader cl = context.getClassLoader();
         return cl.loadClass(className);
      }
      catch (Throwable t)
      {
         throw new FatalBeanException("Cannot load class: " + className + ", context: " + context, t);
      }
   }
View Full Code Here


         ctx = new InitialContext();
         NonSerializableFactory.rebind(ctx, name, beanFactory);
      }
      catch (NamingException e)
      {
         throw new FatalBeanException("Unable to bind BeanFactory into JNDI", e);
      }
      finally
      {
         if (ctx != null)
         {
View Full Code Here

         ctx.unbind(name);
         NonSerializableFactory.unbind(name);
      }
      catch (NamingException e)
      {
         throw new FatalBeanException("Unable to unbind BeanFactory from JNDI", e);
      }
      finally
      {
         if (ctx != null)
         {
View Full Code Here

                    log.debug("Initializing bean [" + name + "]...");
                }

                ((Initializable) object).init();
            } catch (Exception e) {
                throw new FatalBeanException("Error initializing bean [" + name + "]", e);
            }
        }
        return object;
    }
View Full Code Here

                    log.debug("Destroying bean [" + name + "]...");
                }

                ((Destroyable) object).destroy();
            } catch (Exception e) {
                throw new FatalBeanException("Error destroying bean [" + name + "]", e);
            }
        }
    }
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 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");
        }
        return null;
      }
      Map matchingBeans = findAutowireCandidates(beanName, elementType, descriptor);
      if (matchingBeans.isEmpty()) {
        if (descriptor.isRequired()) {
          throw new NoSuchBeanDefinitionException(elementType,
              "Unsatisfied dependency of type [" + elementType.getName() + "]: expected at least 1 matching bean");
        }
        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("Map key type must be assignable to [" + String.class.getName() + "]");
        }
        return null;
      }
      Class valueType = descriptor.getMapValueType();
      if (valueType == null) {
        if (descriptor.isRequired()) {
          throw new FatalBeanException("No value type declared for map");
        }
        return null;
      }
      Map 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

          if (this.ignoreUnresolvableEditors) {
            logger.info("Skipping editor [" + value + "] for required type [" + key + "]: " +
                (requiredType != null ? "editor" : "required type") + " class not found.");
          }
          else {
            throw new FatalBeanException(
                (requiredType != null ? "Editor" : "Required type") + " class not found", ex);
          }
        }
      }
    }
View Full Code Here

    }
    else if (feature instanceof JsonGenerator.Feature) {
      this.objectMapper.configure((JsonGenerator.Feature) feature, enabled);
    }
    else {
      throw new FatalBeanException("Unknown feature class " + feature.getClass().getName());
    }
  }
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.