Here is the exception: org.apache.webbeans.exception.WebBeansConfigurationException: If bean has a public field, bean scope must be defined as @Scope. Bean is : com.maxtorzito.test.MyBeanThree at org.apache.webbeans.inject.impl.InjectionPointFactory.buildInjectionPoints(InjectionPointFactory.java:87) at org.apache.webbeans.container.InjectionTargetFactoryImpl.createInjectionPoints(InjectionTargetFactoryImpl.java:68) at org.apache.webbeans.container.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:60) at org.apache.webbeans.component.InjectionTargetBean.<init>(InjectionTargetBean.java:82) at org.apache.webbeans.component.InjectionTargetBean.<init>(InjectionTargetBean.java:66) at org.apache.webbeans.component.ManagedBean.<init>(ManagedBean.java:39) at org.apache.webbeans.component.creation.ManagedBeanBuilder.getBean(ManagedBeanBuilder.java:62) at org.apache.webbeans.config.BeansDeployer.defineManagedBean(BeansDeployer.java:920) at org.apache.webbeans.config.BeansDeployer.deploySingleAnnotatedType(BeansDeployer.java:610) at org.apache.webbeans.config.BeansDeployer.deployFromClassPath(BeansDeployer.java:540) at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:185) at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:182) at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:158) at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:62) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1225) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:977) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:124) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722)
*Romain Manni-Bucau* *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* *Github: https://github.com/rmannibucau* 2013/6/12 Howard W. Smith, Jr. <[email protected]> > On Tue, Jun 11, 2013 at 8:17 AM, John D. Ament <[email protected] > >wrote: > > > Don't forget, most of these specs expect javabeans - POJOs w/ private > > fields & getters/setters/issers. > > > > > I wanted John's earlier point mentioned again. this is how i learned > it....as I learned Java EE via Java EE 6 tutorial and JSF reference > implementation (Glassfish/Mojarra). > > Java EE 6 tutorial (I'm paraphrasing here) taught the following (and I'm > referring to points you made Jose in an earlier email)... > > 1. xhtml file should reference (public) getter/setter methods of 'managed > beans' > > 2. managed beans should contain (public) getter/setter methods to 'access' > (private) managed bean attributes. > > Jose, you said that you accidentally defined bean attributes as 'public' > instead of 'private', and then you experienced this error. Now, my > question, still...is the 'caused by exception' appropriate/correct > according to 'spec'? > > I believe TomEE is working as designed (or as according to Java EE (6) > spec/tutorial and/or according to 'reference implementation' (RI))... > > 1. an exception is raised when 'public' getter/setter methods are available > for 'public' attributes; interesting, this confuses TomEE (or CODI); > confuses bean manager how to access bean attributes... via public > getter/setter methods OR public attributes? see below... > > public String varA; > > public String getVarA() { > return varA; > } > > public void setVarA(String varA) { > this.varA = varA; > } > > xhtml: > > <h:outputText value="#{bean.varA}"/> > > 2. 'no' exception is raised when developer develops software, um, according > to Java EE spec/tutorial... private bean attributes, public getter/setter > methods, xhtml referencing bean attributes via public getter/setter > methods; this makes for a happy TomEE/CODI/beanmanager/camper! Life is > good! :-) >
