Package org.apache.webbeans.exception

Examples of org.apache.webbeans.exception.WebBeansConfigurationException


                        if (!injectionPoint.isDelegate()) {
                            manager.validate(injectionPoint);
                        } else {
                            if (!bean.getBeanClass().isAnnotationPresent(javax.decorator.Decorator.class)
                                    && !webBeansContext.getBeanManagerImpl().containsCustomDecoratorClass(bean.getBeanClass())) {
                                throw new WebBeansConfigurationException(
                                        "Delegate injection points can not defined by beans that are not decorator. Injection point : "
                                                + injectionPoint);
                            }
                        }
                    }
View Full Code Here


                        InjectionResolver resolver = webBeansContext.getBeanManagerImpl().getInjectionResolver();
                        Set<Bean<?>> beans = resolver.implResolveByName(beanName);
                        if (beans.size() > 1) {
                            beans = resolver.findByAlternatives(beans);
                            if (beans.size() > 1) {
                                throw new WebBeansConfigurationException("There are two different beans with name : " + beanName + " in the deployment archieve");
                            }
                        }
                    } else {
                        if (part != null) {
                            if (part.equals(other)) {
                                throw new WebBeansConfigurationException("EL name of one bean is of the form x.y, where y is a valid bean EL name, and " +
                                        "x is the EL name of the other bean for the bean name : " + beanName);
                            }
                        }
                    }
                }
View Full Code Here

                ArrayList<Class<?>> specialClassList = new ArrayList<Class<?>>();
                for (Class<?> specialClass : beanClasses) {
                    if (AnnotationUtil.hasClassAnnotation(specialClass, Specializes.class)) {
                        superClass = specialClass.getSuperclass();
                        if (superClass.equals(Object.class)) {
                            throw new WebBeansConfigurationException(logger.getTokenString(OWBLogConst.EXCEPT_0003) + specialClass.getName()
                                    + logger.getTokenString(OWBLogConst.EXCEPT_0004));
                        }
                        if (superClassList.contains(superClass)) {
                            throw new InconsistentSpecializationException(logger.getTokenString(OWBLogConst.EXCEPT_0005) + superClass.getName());
                        }
View Full Code Here

                validate = true;
            }
        } else if (webBeansContext.getBeanManagerImpl().isPassivatingScope(beanObj.getScope())) {
            if (WebBeansUtil.isPassivationCapable(beanObj) == null) {
                if (!(beanObj instanceof AbstractProducerBean)) {
                    throw new WebBeansConfigurationException("Passivation scoped defined bean must be passivation capable, " +
                            "but bean : " + beanObj.toString() + " is not passivation capable");
                } else {
                    validate = true;
                }
            }
View Full Code Here

        {
            if (AnnotationUtil.isAnnotationExist(field.getAnnotations(), Decorates.class))
            {
                if (found)
                {
                    throw new WebBeansConfigurationException("Decorator class : " + decoratorClazz.getName() + " can only contain one delegate attribute but find more than one!.");
                }
                else
                {
                    Class<?> fieldType = field.getType();
                    if (!ClassUtil.isInterface(fieldType.getModifiers()))
                    {
                        throw new WebBeansConfigurationException("Decorator class : " + decoratorClazz.getName() + " delegate attribute type must be interface");
                    }

                    for (Class<?> decType : decoratorSet)
                    {
                        if (!fieldType.isAssignableFrom(decType))
                        {
                            throw new WebBeansConfigurationException("Decorator class : " + decoratorClazz.getName() + " delegate attribute must implement all of the decorator decorated types.");
                        }
                    }

                    found = true;
                }
View Full Code Here

        if (!decoratorList.isEmpty())
        {
            Class<?> clazz = component.getReturnType();
            if (ClassUtil.isFinal(clazz.getModifiers()))
            {
                throw new WebBeansConfigurationException("Simple web bean component : " + component.getReturnType().getName() + " can not be declared final, because it has one or more decorators");
            }

            Method[] methods = clazz.getDeclaredMethods();
            for (Method method : methods)
            {
                int modifiers = method.getModifiers();
                if (!ClassUtil.isStatic(modifiers) && !ClassUtil.isPrivate(modifiers) && ClassUtil.isFinal(modifiers))
                {
                    // Check decorator implements this
                    Iterator<Decorator> itDecorator = decoratorList.iterator();
                    while (itDecorator.hasNext())
                    {
                        WebBeansDecorator decorator = (WebBeansDecorator) itDecorator.next();
                        Class<?> decClazz = decorator.getClazz();

                        try
                        {
                            if (decClazz.getMethod(method.getName(), method.getParameterTypes()) != null)
                            {
                                throw new WebBeansConfigurationException("Simple web bean component : " + component.getReturnType().getName() + " can not define non-private, non-static, final method : " + method.getName() + ", because one of its decorators implements this method");

                            }

                        }
                        catch (SecurityException e)
View Full Code Here

        if (ejbBean.getEjbType().equals(SessionBeanType.STATELESS))
        {
            if (!ejbBean.getScope().equals(Dependent.class))
            {
                throw new WebBeansConfigurationException("Stateless Session Bean class : " + ejbBean.getReturnType() + " " + "can not define scope other than @Dependent");
            }
        }
        else if (ejbBean.getEjbType().equals(SessionBeanType.SINGLETON))
        {
            if (!ejbBean.getScope().equals(Dependent.class) && !ejbBean.getScope().equals(ApplicationScoped.class))
            {
                throw new WebBeansConfigurationException("Singleton Session Bean class : " + ejbBean.getReturnType() + " "
                                                         + "can not define scope other than @Dependent or @ApplicationScoped");
            }
        }
    }
View Full Code Here

    {
        Asserts.assertNotNull(ejbClass, "ejbClass parameter can not be null");

        if (AnnotationUtil.hasClassAnnotation(ejbClass, Decorator.class))
        {
            throw new WebBeansConfigurationException(EjbConstants.EJB_WEBBEANS_ERROR_CLASS_PREFIX + ejbClass.getName() + " can not annotated with @Decorator");

        }

        if (AnnotationUtil.hasClassAnnotation(ejbClass, Interceptor.class))
        {
            throw new WebBeansConfigurationException(EjbConstants.EJB_WEBBEANS_ERROR_CLASS_PREFIX + ejbClass.getName() + " can not annotated with @Interceptor");
        }
    }
View Full Code Here

       
        if(ClassUtil.isDefinitionContainsTypeVariables(ejbClass))
        {
            if(!scopeType.equals(Dependent.class))
            {
                throw new WebBeansConfigurationException("Ejb generic bean class : " + ejbClass.getName() + "scope must be @Dependent");
            }
        }
    }
View Full Code Here

               
                if(!found)
                {
                    if(!method.isStatic())
                    {
                        throw new WebBeansConfigurationException("Observer method : " + method.getJavaMember().getName() + " in session bean class : " +
                                bean.getBeanClass() + " must be business method");                                           
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.exception.WebBeansConfigurationException

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.