If you have troubles starting tomee then don't hesitate to ping us via IRC on irc.freenode.net in channel #openejb (tomee s hosted there).
LieGrue, strub >________________________________ > From: "Howard W. Smith, Jr." <smithh032...@gmail.com> >To: MyFaces Discussion <users@myfaces.apache.org>; Mark Struberg ><strub...@yahoo.de> >Sent: Saturday, November 17, 2012 12:06 PM >Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans > > >Mark, > > >Thank you for the response. > > >1. Yes, I did add an 'empty' beans.xml to WEB-INF as advised by many places on >the internet, and the app starts up successfully. I did 'not' have beans.xml >added to META-INF, since all of my code is in the web app (I created no JARs >of my own). I just added beans.xml to META-INF (while beans.xhtml already >exists in WEB-INF), attempted to start glassfish, and I get the following >error: > > >INFO: WELD-000900 1.1.8 (Final) >SEVERE: Exception while invoking class org.glassfish.weld.WeldDeployer load >method >java.lang.NullPointerException >at >org.glassfish.weld.BeanDeploymentArchiveImpl.handleEntry(BeanDeploymentArchiveImpl.java:504) >at >org.glassfish.weld.BeanDeploymentArchiveImpl.collectJarInfo(BeanDeploymentArchiveImpl.java:482) >at >org.glassfish.weld.BeanDeploymentArchiveImpl.populate(BeanDeploymentArchiveImpl.java:422) > > >I'm sure the error above means that my web app does not need 'empty' beans.xml >in META-INF (and WEB-INF), so I will remove beans.xml from META-INF. > > >2. Yes, all CDI beans (accessed via EL) have @Named annotation, and I am using >@Inject along with Qualifiers (for classes that extend ancestor classes). >Below are notes from what I did/completed yesterday for this migration: > > >Migrate from JSF Managed Beans to CDI Managed Beans > > >Replace >javax.faces.bean.ManagedBean >with >javax.inject.Named > > >replace >javax.faces.bean.ManagedProperty >with >javax.inject.Inject > > >replace >javax.faces.bean.SessionScoped >with >javax.enterprise.context.SessionScoped > > >replace >javax.faces.bean.ApplicationScoped >with >javax.enterprise.context.ApplicationScoped > > >replace >@ManagedBean(name = >with >@Named( > > >replace >@ManagedProperty("#{.*}") >with >@Inject > > >Migrated applicationScopeBean from JSF ApplicationScoped managed bean to EJB >@Singleton with @Startup (please disregard this, since the last thing I did >with this was to migrate it to CDI applicationscoped instead of EJB singleton >and startup) > > >Added CDI Qualifier called @Descendant for all descendants of Address, >EmailAddress, Phone, and PointOfContact controllers > > >Replace >FacesContext.getCurrentInstance().getExternalContext().getSessionMap() > > >with @Inject and private instance variable > > > > >3. Honestly, I was hoping not to have to migrate to another container like >Tomcat or TomEE, since I only have little/limited experience with those >containers (as I attempted to migrate to Tomcat 7.0.32, 1 or 2 weeks ago, but >too much was involved and I couldn't even get the web app to start). I am open >to trying TomEE, hopefully, as a last-and-final option. :) > > > >On Sat, Nov 17, 2012 at 5:04 AM, Mark Struberg <strub...@yahoo.de> wrote: > >Hi Howard! >> >> >>JUEL is an Expression Language implementation. It has nothing to do with CDI >>apart from CDI providing an ELResolver. JUEL is much faster than the EL >>interpreter in glassfish, so this is fine. >> >>For your beans getting recognized in EL expressions: >> >>1.) Do you have a META-INF/beans.xml in all your jars/classpaths which >>contain CDI beans? This files can be empty, they just act as marker files. >>For the webapp you might add one to WEB-INF/beans.xml. >> >> >>2.) Do your CDI beans you access via EL have a @Named annotation? >>This is needed to make them available for ELResolvers. >> >>3.) glassfish has a few nasty integration issues when it comes to pluggin in >>different container parts. Can you try your app on tomee-1.5? [1]. It comes >>with the latest MyFaces out of the box! >> >>LieGrue, >>strub >> >> >>[1] http://tomee.apache.org/downloads.html >> >> >> >>----- Original Message ----- >>> From: "Howard W. Smith, Jr." <smithh032...@gmail.com> >>> To: MyFaces Discussion <users@myfaces.apache.org> >>> Cc: >>> Sent: Saturday, November 17, 2012 10:35 AM >>> Subject: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans >>> >>> Web application details: >>> JSF 2.1, MyFaces 2.1.9, PrimeFaces 3.4.1 (or 3.5-SNAPSHOT), Glassfish >>> 3.1.2.2 (build 5), JUEL 2.2.5 >>> >>> From server log: >>> INFO: WELD-000900 1.1.8 (Final) >>> >>> Yesterday, I started migrating from JSF Managed Beans to CDI Managed Beans. >>> I referred to Chapter 28 (CDI) of Oracle's Java EE 6 >>> Tutorial<http://docs.oracle.com/javaee/6/tutorial/doc/giwhb.html>as >> >>> well as many other pages I found on the internet. >>> >>> Finally, the app starts, as I think I completed most steps necessary to >>> migrate to CDI managed beans, but now it seems as though my beans are not >>> accessible from facelets. As per >>> MYFACES-3104<https://issues.apache.org/jira/browse/MYFACES-3104>, >>> I am already using *JUEL 2.2.5* (that is working well with JSF Managed >>> Beans in production), so I already had * >>> org.apache.myfaces.EXPRESSION_FACTORY* set in web.xml, as well as >>> *org.apache.myfaces.SUPPORT_JSP_AND_FACES_EL >>> *to *false*, and the last thing I did was add the following to web.xml: >> >>> >>> <context-param> >>> >>> <param-name>org.apache.myfaces.annotation.SCAN_PACKAGES</param-name> >>> <param-value>pf,jsf.users,jsf.orders</param-value> >>> </context-param> >>> >>> Which are just a 'few' of the packages that contained beans referenced >>> by >>> the initial page of the app (login.xhtml). >>> >>> My questions: >>> >>> 1. Can someone please advise me of blog/tutorials that list any/all >> >>> steps necessary to migrate MyFaces 2.1.9 / Glassfish 3.1.2.2 web app from >>> JSF Managed Beans to CDI? >>> 2. I am not using MyFaces CODI or OpenWebBeans (yet). I've seen >> >>> OpenWebBeans recommended with MyFaces Core (2.1.7+) for performance >>> reasons, and in PrimeFaces forum, I've seen MyFaces Core and MyFaces CODI >>> used together by some people. If I should use MyFaces CODI or >>> OpenWebBeans, >>> please reply with blog/tutorial/instruction URLs. >>> >>> My next steps will probably be any/all of the following: >>> >>> 1. Remove JUEL 2.2.5 from the project, and see if I can successfully get >> >>> my pages to render via CDI >>> 2. Add MyFaces CODI (need to search for a good set of instructions on >>> how to do so) >>> 3. Add OpenWebBeans (same as above, need good set of instructions) >> >>> >>> Please confirm/advise. If you need any more details from me (for example, >>> for me to reply with my web.xml), then please let me know. >>> >>> Thanks, >>> Howard >>> >> > > >