Package org.springframework.beans

Examples of org.springframework.beans.FatalBeanException


                try {
                    DocumentBuilder builder = new SourceTransformer().createDocumentBuilder();
                    Document doc = builder.parse(url.toString());
                    classLoader = getClassLoader(applicationContext, reader, doc);
                } catch (Exception e) {
                    throw new FatalBeanException("Unable to load classpath.xml file", e);
                }
            } else {
                try {
                    URL[] urls = getDefaultLocations();
                    ClassLoader parentLoader = getParentClassLoader(applicationContext);
                    classLoader = new JarFileClassLoader(applicationContext.getDisplayName(), urls, parentLoader);
                    // assign the class loader to the xml reader and the
                    // application context
                } catch (Exception e) {
                    throw new FatalBeanException("Unable to create default classloader for SU", e);
                }
            }
        } else {
            classLoader = getClassLoader(applicationContext, reader, document);
        }
View Full Code Here


                    urls[i+1] = jars[i].toURL();
                }
            }
            return urls;
        } catch (MalformedURLException e) {
            throw new FatalBeanException("Unable to get default classpath locations", e);
        }
    }
View Full Code Here

        ClassLoader classLoader;
        NodeList classpathElements = document.getDocumentElement().getElementsByTagName("classpath");
        if (classpathElements.getLength() < 1) {
            classLoader = getParentClassLoader(applicationContext);
        } else if (classpathElements.getLength() > 1) {
            throw new FatalBeanException("Expected only classpath element but found " + classpathElements.getLength());
        } else {
            Element classpathElement = (Element) classpathElements.item(0);
           
            // Delegation mode
            boolean inverse = false;
            String inverseAttr = classpathElement.getAttribute("inverse");
            if (inverseAttr != null && "true".equalsIgnoreCase(inverseAttr)) {
                inverse = true;
            }

            // build hidden classes
            List<String> hidden = new ArrayList<String>();
            NodeList hiddenElems = classpathElement.getElementsByTagName("hidden");
            for (int i = 0; i < hiddenElems.getLength(); i++) {
                Element hiddenElement = (Element) hiddenElems.item(i);
                String pattern = ((Text) hiddenElement.getFirstChild()).getData().trim();
                hidden.add(pattern);
            }

            // build non overridable classes
            List<String> nonOverridable = new ArrayList<String>();
            NodeList nonOverridableElems = classpathElement.getElementsByTagName("nonOverridable");
            for (int i = 0; i < nonOverridableElems.getLength(); i++) {
                Element nonOverridableElement = (Element) nonOverridableElems.item(i);
                String pattern = ((Text) nonOverridableElement.getFirstChild()).getData().trim();
                nonOverridable.add(pattern);
            }

            // build the classpath
            List<String> classpath = new ArrayList<String>();
            NodeList locations = classpathElement.getElementsByTagName("location");
            for (int i = 0; i < locations.getLength(); i++) {
                Element locationElement = (Element) locations.item(i);
                String location = ((Text) locationElement.getFirstChild()).getData().trim();
                classpath.add(location);
            }
           
            // Add shared libraries
            List<String> sls = new ArrayList<String>();
            NodeList libraries = classpathElement.getElementsByTagName("library");
            for (int i = 0; i < libraries.getLength(); i++) {
                Element locationElement = (Element) libraries.item(i);
                String library = ((Text) locationElement.getFirstChild()).getData().trim();
                sls.add(library);
            }
            if (sls.size() > 0 && container == null) {
                throw new IllegalStateException("Can not reference shared libraries if the component is not deployed in ServiceMix");
            }

            // Add components
            List<String> components = new ArrayList<String>();
            NodeList componentList = classpathElement.getElementsByTagName("component");
            for (int i = 0; i < componentList.getLength(); i++) {
                Element locationElement = (Element) componentList.item(i);
                String component = ((Text) locationElement.getFirstChild()).getData().trim();
                components.add(component);
            }
            if (components.size() > 0 && container == null) {
                throw new IllegalStateException("Can not reference other components if the component is not deployed in ServiceMix");
            }

            // convert the paths to URLS
            URL[] urls;
            if (classpath.size() != 0) {
                urls = new URL[classpath.size()];
                for (ListIterator<String> iterator = classpath.listIterator(); iterator.hasNext();) {
                    String location = iterator.next();
                    URL url = repository.getResource(location);
                    if (url == null) {
                        throw new FatalBeanException("Unable to resolve classpath location " + location);
                    }
                    urls[iterator.previousIndex()] = url;
                }
            } else {
                urls = getDefaultLocations();
View Full Code Here

                    Advised advised = (Advised) auth;
                    TargetSource targetSource = advised.getTargetSource();
                    if(targetSource instanceof LazyInitTargetSource) {
                        LazyInitTargetSource lits = (LazyInitTargetSource) targetSource;
                        if(beanNames.contains(lits.getTargetBeanName())) {
                            throw new FatalBeanException("A dependency cycle was detected when trying to resolve the AuthenticationManager. Please ensure you have configured authentication.");
                        }
                    }
                }
                beanNames = Collections.emptySet();
            }
View Full Code Here

            } else {
                try {
                    Object obj = ClassLoaderUtils.loadClass(val, getClass()).newInstance();
                    bean.addConstructorArg(obj);
                } catch (Exception e) {
                    throw new FatalBeanException("Could not load class: " + val, e);
                }
            }
        }
    }
View Full Code Here

        Class clazz = loadClass(className);
        RequestMapping path = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);
        if (path == null) {
            String value = resolvePathFromServiceInterface(clazz);
            if (value == null) {
                throw new FatalBeanException("Could not resolve GWT remote service path - either define a @RemoteServiceRelativePath annotation on the" +
                        "remote service interface or define a @RequestMapping annotation on the service '" +
                        clazz.getName() + "' class hierarchy");
            }
            return new String[] { value };
        }
View Full Code Here

    protected Class loadClass(String className) {
        try {
            return ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
        } catch (ClassNotFoundException cnfe){
            throw new FatalBeanException("Cannot load class '" + className + "'", cnfe);
        }
    }
View Full Code Here

        PropertyDescriptor pd = new PropertyDescriptor("value", ValueBean.class);
        pd.setPropertyEditorClass(MyNumberEditor.class);
        return new PropertyDescriptor[] {pd};
      }
      catch (IntrospectionException ex) {
        throw new FatalBeanException("Couldn't create PropertyDescriptor", ex);
      }
    }
View Full Code Here

            if (!ContextLoader.getCurrentWebApplicationContext().getBean("licenseChecker")
                    .getClass().getName().equals("org.jahia.security.license.LicenseChecker")
                    || !ContextLoader.getCurrentWebApplicationContext().getBean("LicenseFilter")
                            .getClass().getName()
                            .equals("org.jahia.security.license.LicenseFilter")) {
                throw new FatalBeanException("Required classes for license manager were not found");
            }
        } catch (NoSuchBeanDefinitionException e) {
            throw new FatalBeanException("Required classes for license manager were not found", e);
        }
    }
View Full Code Here

      {
         return org.jboss.beans.metadata.spi.factory.BeanFactory.class.cast(factory).createBean();
      }
      catch (Throwable t)
      {
         throw new FatalBeanException("Cannot create bean: " + factory, t);
      }
   }
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.