[weld-issues] [JBoss JIRA] Created: (WELD-733) Better error message for @ManagedBean annotated Beans that do not have a no-arg constructor

Sivakumar Thyagarajan (JIRA) jira-events at lists.jboss.org
Tue Oct 19 06:55:54 EDT 2010


Better error message for @ManagedBean annotated Beans that do not have a no-arg constructor
-------------------------------------------------------------------------------------------

                 Key: WELD-733
                 URL: https://jira.jboss.org/browse/WELD-733
             Project: Weld
          Issue Type: Feature Request
          Components: Class Beans (Managed and Session)
            Reporter: Sivakumar Thyagarajan


If we have an @ManagedBean annotated class that does not have a no-arg constructor, and is CDI-enabled(for instance has an interceptor binding annotation assigned to one of its methods), Weld proxy creation fails with an InstantiationException(see below) because of the missing no-arg ctor. It would be nice if Weld detects this case better and provides a better error message. I have filed a GlassFish issue (GlassFish issue 14076) for us to fail deployment, but Weld's handling of this issue would help GlassFish and other containers.

Caused by: org.jboss.weld.exceptions.DeploymentException: test.beans.org$jboss$weld$bean-$export$work$workspaces$gfv3$v3$distributions$glassfish$target$glassfish3$glassfish$domains$domain1$applications$cdi-simple-managed-bean-interceptor-web$-ManagedBean-class_test$beans$TestManagedBean_$$_WeldProxy
	at org.jboss.weld.bean.ManagedBean.applyInterceptors(ManagedBean.java:600)
	at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.produce(ManagedBean.java:256)
	at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:338)
	at org.jboss.weld.context.DependentContext.get(DependentContext.java:62)
	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:660)
	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:734)
	at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:757)
	at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)
	at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:840)
	at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:852)
	at org.jboss.weld.manager.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:122)
	at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:134)
	at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:50)
	at org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:116)
	at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:227)
	at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:181)
	at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:478)
	at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:428)
	at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:300)
	... 28 more
Caused by: org.jboss.weld.exceptions.DefinitionException: test.beans.org$jboss$weld$bean-$export$work$workspaces$gfv3$v3$distributions$glassfish$target$glassfish3$glassfish$domains$domain1$applications$cdi-simple-managed-bean-interceptor-web$-ManagedBean-class_test$beans$TestManagedBean_$$_WeldProxy
	at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:223)
	at org.jboss.weld.bean.ManagedBean.applyInterceptors(ManagedBean.java:594)
	... 46 more
Caused by: java.lang.InstantiationException: test.beans.org$jboss$weld$bean-$export$work$workspaces$gfv3$v3$distributions$glassfish$target$glassfish3$glassfish$domains$domain1$applications$cdi-simple-managed-bean-interceptor-web$-ManagedBean-class_test$beans$TestManagedBean_$$_WeldProxy
	at java.lang.Class.newInstance0(Class.java:340)
	at java.lang.Class.newInstance(Class.java:308)
	at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:396)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
	at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:216)
	at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:391)
	at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:218)
	... 47 more
|#]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list