You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Mark Struberg <st...@yahoo.de> on 2012/11/17 18:31:45 UTC

Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans

Hi Howard!

cross-posting to openejb-dev which is the community behind TomEE.

Juel is an Expression Language library which parses the EL expressions and invokes the various registered ELResolvers until one of them feels responsible. 

TomEE (like glassfish) contains plain tomcat which has an own EL library in jasper-el. 
Please remove juel for now. We will add it back later. also comment out the expression factory context-param in your web.xml.

I'm not sure if that helps, but via remote I can only to give you tips until we found the problem.


PS: TODO we gonna write up a documentation about how to use JUEL with TomEE.



----- Original Message -----
> From: "Howard W. Smith, Jr." <sm...@gmail.com>
> To: MyFaces Discussion <us...@myfaces.apache.org>
> Cc: 
> Sent: Saturday, November 17, 2012 5:49 PM
> Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans
> 
> Okay, I downloaded TomEE 1.5 plus, and trying to start the app.
> 
> I have the following in my web.xml:
> 
>     <context-param>
>         
> <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
>         
> <param-value>de.odysseus.el.ExpressionFactoryImpl</param-value>
>     </context-param>
> 
> The error(s) below leads me to believe that I may need to remove JUEL 2.2.5
> from my web app. Please confirm/advise.
> 
> Nov 17, 2012 11:37:24 AM org.apache.catalina.loader.WebappClassLoader
> validateJarFile
> INFO:
> validateJarFile(C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\juel-2.2.5.jar)
> - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
> javax/el/Expression.class
> Nov 17, 2012 11:37:24 AM org.apache.tomee.catalina.TomEEClassLoaderEnricher
> validateJarFile
> WARNING: jar
> 'C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\transaction-api-1.1.jar'
> contains offending class: javax.transaction.Transaction. It will be ignored.
> 
> 
> Nov 17, 2012 11:37:33 AM org.apache.openejb.cdi.CdiAppContextsService
> lazyStartSessionContext
> WARNING: Could NOT lazily initialize session context because of null
> RequestContext
> Nov 17, 2012 11:37:33 AM org.apache.myfaces.webapp.AbstractFacesInitializer
> initFaces
> SEVERE: An error occured while initializing MyFaces: No
> javax.el.ExpressionFactory found. Please provide <context-param> in
> web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> javax.faces.FacesException: No javax.el.ExpressionFactory found. Please
> provide <context-param> in web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> at
> org.apache.myfaces.webapp.FaceletsInitilializer.initContainerIntegration(FaceletsInitilializer.java:42)
> 
> 
> 
> 
> On Sat, Nov 17, 2012 at 11:22 AM, Gerhard Petracek <
> gerhard.petracek@gmail.com> wrote:
> 
>>  hi jose,
>> 
>>  just fyi:
>>  with tomee you don't need weld, because you get openwebbeans
>>  out-of-the-box.
>> 
>>  regards,
>>  gerhard
>> 
>>  http://www.irian.at
>> 
>>  Your JSF/JavaEE powerhouse -
>>  JavaEE Consulting, Development and
>>  Courses in English and German
>> 
>>  Professional Support for Apache MyFaces
>> 
>> 
>> 
>>  2012/11/17 José Luis Cetina <ma...@gmail.com>
>> 
>>  > Hi let me tell you my experience.
>>  > I migrate from managedbeans + mojarra + glassfish to myfaces + WELD +
>>  TomEE
>>  > and now I'm so happy to did so.
>>  >
>>  > Now my app use:
>>  > -Apache TomEE 1.5
>>  > -Apache MyFaces
>>  > -Apache CODI
>>  > -Primefaces 3.4.2
>>  > -Primefaces Mobile
>>  > -Primefaces Extensions 0.6.1
>>  > -PrettyFaces  3.3.3
>>  > -OpenJPA 2.2
>>  > -EJB
>>  > -JdbcRealm for login (my own query for login using any tables in my 
> mysql
>>  > database).
>>  > -WELD
>>  > -And all the excellent Apache stuff
>>  > Etc...
>>  >
>>  > And I'm so happy with this change, the this are more easy to 
> config, use
>>  > more standards, is very very fast, use myfaces and with this you can
>>  forget
>>  > speed issues.
>>  >
>>  > This project is a maven project, in netbeans 7.2.
>>  >
>>  > If you need some example project I can send you a simple example.
>>  >
>>  > I enhance my jpa entities so easy with maven plugin, run in every IDE 
> and
>>  > other stuff that are excellents
>>  >
>>  > Seriously if have the opportunity and time to migrate do it now you 
> will
>>  be
>>  > happy.
>>  >
>>  > And one tip maybe you don't need CODI at the beginning. CODI can 
> help in
>>  > many things like type-safe navigations, security, validations,
>>   prerenders
>>  > events and so on.
>>  >
>>  > Al most forget to tell you the easy Way for drop your jars in lib 
> folder
>>  > and with this decrease your war size, I remember in glassfish 
> sometimes
>>  it
>>  > wasn't easy.
>>  >
>>  > I recommend you to be alert for changes and fixes in TomEE, because 
> they
>>  > fix issues and update in they trunk svn everyday.
>>  >
>>  > Please suscribe to TomEE mailing lists. Rommain is a great commiter 
> guy
>>  who
>>  > help immediately with other people.
>>  >
>>  > I hope this experience can help you.
>>  >
>>  > SCJA. Jose Luis Cetina
>>  > maxtorzito
>>  >  El 17/11/2012 06:06, "Mark Struberg" 
> <st...@yahoo.de> escribió:
>>  >
>>  > > Hi!
>>  > >
>>  > > If you look for docs, here they are:
>>  > >
>>  > > http://tomee.apache.org/documentation.html
>>  > >
>>  > > LieGrue,
>>  > > strub
>>  > >
>>  > >
>>  > >
>>  > >
>>  > >
>>  > >
>>  > >
>>  > > >________________________________
>>  > > > From: "Howard W. Smith, Jr." 
> <sm...@gmail.com>
>>  > > >To: Mark Struberg <st...@yahoo.de>
>>  > > >Cc: MyFaces Discussion <us...@myfaces.apache.org>
>>  > > >Sent: Saturday, November 17, 2012 1:02 PM
>>  > > >Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to 
> CDI
>>  > Managed
>>  > > Beans
>>  > > >
>>  > > >
>>  > > >Great, thanks Mark. I did download TomEE, and looking at 
> examples
>>  > > (referenced on same page as TomEE downloads) and I'm looking 
> at this
>>  > guide
>>  > > below to ensure I am injecting beans correctly.
>>  > > >
>>  > > >
>>  > > 
>> http://docs.jboss.org/weld/reference/1.0.0/en-US/html/injection.html
>>  > > >
>>  > > >
>>  > > >
>>  > > >On Sat, Nov 17, 2012 at 6:50 AM, Mark Struberg 
> <st...@yahoo.de>
>>  > wrote:
>>  > > >
>>  > > >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." 
> <sm...@gmail.com>
>>  > > >>>To: MyFaces Discussion 
> <us...@myfaces.apache.org>; Mark Struberg <
>>  > > struberg@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 
> <st...@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." 
> <sm...@gmail.com>
>>  > > >>>>> To: MyFaces Discussion 
> <us...@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
>>  > > >>>>>
>>  > > >>>>
>>  > > >>>
>>  > > >>>
>>  > > >>>
>>  > > >>
>>  > > >
>>  > > >
>>  > > >
>>  > >
>>  >
>> 
> 

Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans

Posted by José Luis Cetina <ma...@gmail.com>.
Howard please the best place for ask TomEE stuff is to suscribe:
users@openejb.apache.org
El 17/11/2012 11:49, "Howard W. Smith, Jr." <sm...@gmail.com>
escribió:

> Done. I removed JUEL (and MyFaces CODI), for now, from classpath as well as
> web.xml.
>
> FYI, with respect to writeup, how to use Juel with TomEE/OpenWebBeans, I
> used instructions at the following URL:
>
> http://tandraschko.blogspot.de/2012/08/increase-your-jsf-application.html
>
>
> Before and after removing JUEL (and MyFaces CODI), I have been getting the
> following exception in the server log:
>
> Nov 17, 2012 12:35:49 PM org.apache.tomee.catalina.OpenEJBContextConfig
> processAnnotationsFile
> SEVERE: OpenEJBContextConfig.processAnnotationsFile: failed.
> java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence
> near index 3
> C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\classes
>    ^
>
> Does this mean that I should do as Jose recommended to me earlier...add
> any/all JARs to tomee /lib folder? I am deploying via NetBeans 7.2's Deploy
> option against TomEE. Should I deploy the generated WAR file, manually, by
> dropping WAR file in tomee webapps folder instead?
>
>
> On Sat, Nov 17, 2012 at 12:31 PM, Mark Struberg <st...@yahoo.de> wrote:
>
> > Hi Howard!
> >
> > cross-posting to openejb-dev which is the community behind TomEE.
> >
> > Juel is an Expression Language library which parses the EL expressions
> and
> > invokes the various registered ELResolvers until one of them feels
> > responsible.
> >
> > TomEE (like glassfish) contains plain tomcat which has an own EL library
> > in jasper-el.
> > Please remove juel for now. We will add it back later. also comment out
> > the expression factory context-param in your web.xml.
> >
> > I'm not sure if that helps, but via remote I can only to give you tips
> > until we found the problem.
> >
> >
> > PS: TODO we gonna write up a documentation about how to use JUEL with
> > TomEE.
> >
> >
> >
> > ----- Original Message -----
> > > From: "Howard W. Smith, Jr." <sm...@gmail.com>
> > > To: MyFaces Discussion <us...@myfaces.apache.org>
> > > Cc:
> > > Sent: Saturday, November 17, 2012 5:49 PM
> > > Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI
> > Managed Beans
> > >
> > > Okay, I downloaded TomEE 1.5 plus, and trying to start the app.
> > >
> > > I have the following in my web.xml:
> > >
> > >     <context-param>
> > >
> > > <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
> > >
> > > <param-value>de.odysseus.el.ExpressionFactoryImpl</param-value>
> > >     </context-param>
> > >
> > > The error(s) below leads me to believe that I may need to remove JUEL
> > 2.2.5
> > > from my web app. Please confirm/advise.
> > >
> > > Nov 17, 2012 11:37:24 AM org.apache.catalina.loader.WebappClassLoader
> > > validateJarFile
> > > INFO:
> > >
> >
> validateJarFile(C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\juel-2.2.5.jar)
> > > - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
> > > javax/el/Expression.class
> > > Nov 17, 2012 11:37:24 AM
> > org.apache.tomee.catalina.TomEEClassLoaderEnricher
> > > validateJarFile
> > > WARNING: jar
> > >
> >
> 'C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\transaction-api-1.1.jar'
> > > contains offending class: javax.transaction.Transaction. It will be
> > ignored.
> > >
> > >
> > > Nov 17, 2012 11:37:33 AM org.apache.openejb.cdi.CdiAppContextsService
> > > lazyStartSessionContext
> > > WARNING: Could NOT lazily initialize session context because of null
> > > RequestContext
> > > Nov 17, 2012 11:37:33 AM
> > org.apache.myfaces.webapp.AbstractFacesInitializer
> > > initFaces
> > > SEVERE: An error occured while initializing MyFaces: No
> > > javax.el.ExpressionFactory found. Please provide <context-param> in
> > > web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> > > javax.faces.FacesException: No javax.el.ExpressionFactory found. Please
> > > provide <context-param> in web.xml:
> org.apache.myfaces.EXPRESSION_FACTORY
> > > at
> > >
> >
> org.apache.myfaces.webapp.FaceletsInitilializer.initContainerIntegration(FaceletsInitilializer.java:42)
> > >
> > >
> > >
> > >
> > > On Sat, Nov 17, 2012 at 11:22 AM, Gerhard Petracek <
> > > gerhard.petracek@gmail.com> wrote:
> > >
> > >>  hi jose,
> > >>
> > >>  just fyi:
> > >>  with tomee you don't need weld, because you get openwebbeans
> > >>  out-of-the-box.
> > >>
> > >>  regards,
> > >>  gerhard
> > >>
> > >>  http://www.irian.at
> > >>
> > >>  Your JSF/JavaEE powerhouse -
> > >>  JavaEE Consulting, Development and
> > >>  Courses in English and German
> > >>
> > >>  Professional Support for Apache MyFaces
> > >>
> > >>
> > >>
> > >>  2012/11/17 José Luis Cetina <ma...@gmail.com>
> > >>
> > >>  > Hi let me tell you my experience.
> > >>  > I migrate from managedbeans + mojarra + glassfish to myfaces +
> WELD +
> > >>  TomEE
> > >>  > and now I'm so happy to did so.
> > >>  >
> > >>  > Now my app use:
> > >>  > -Apache TomEE 1.5
> > >>  > -Apache MyFaces
> > >>  > -Apache CODI
> > >>  > -Primefaces 3.4.2
> > >>  > -Primefaces Mobile
> > >>  > -Primefaces Extensions 0.6.1
> > >>  > -PrettyFaces  3.3.3
> > >>  > -OpenJPA 2.2
> > >>  > -EJB
> > >>  > -JdbcRealm for login (my own query for login using any tables in my
> > > mysql
> > >>  > database).
> > >>  > -WELD
> > >>  > -And all the excellent Apache stuff
> > >>  > Etc...
> > >>  >
> > >>  > And I'm so happy with this change, the this are more easy to
> > > config, use
> > >>  > more standards, is very very fast, use myfaces and with this you
> can
> > >>  forget
> > >>  > speed issues.
> > >>  >
> > >>  > This project is a maven project, in netbeans 7.2.
> > >>  >
> > >>  > If you need some example project I can send you a simple example.
> > >>  >
> > >>  > I enhance my jpa entities so easy with maven plugin, run in every
> IDE
> > > and
> > >>  > other stuff that are excellents
> > >>  >
> > >>  > Seriously if have the opportunity and time to migrate do it now you
> > > will
> > >>  be
> > >>  > happy.
> > >>  >
> > >>  > And one tip maybe you don't need CODI at the beginning. CODI can
> > > help in
> > >>  > many things like type-safe navigations, security, validations,
> > >>   prerenders
> > >>  > events and so on.
> > >>  >
> > >>  > Al most forget to tell you the easy Way for drop your jars in lib
> > > folder
> > >>  > and with this decrease your war size, I remember in glassfish
> > > sometimes
> > >>  it
> > >>  > wasn't easy.
> > >>  >
> > >>  > I recommend you to be alert for changes and fixes in TomEE, because
> > > they
> > >>  > fix issues and update in they trunk svn everyday.
> > >>  >
> > >>  > Please suscribe to TomEE mailing lists. Rommain is a great commiter
> > > guy
> > >>  who
> > >>  > help immediately with other people.
> > >>  >
> > >>  > I hope this experience can help you.
> > >>  >
> > >>  > SCJA. Jose Luis Cetina
> > >>  > maxtorzito
> > >>  >  El 17/11/2012 06:06, "Mark Struberg"
> > > <st...@yahoo.de> escribió:
> > >>  >
> > >>  > > Hi!
> > >>  > >
> > >>  > > If you look for docs, here they are:
> > >>  > >
> > >>  > > http://tomee.apache.org/documentation.html
> > >>  > >
> > >>  > > LieGrue,
> > >>  > > strub
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > > >________________________________
> > >>  > > > From: "Howard W. Smith, Jr."
> > > <sm...@gmail.com>
> > >>  > > >To: Mark Struberg <st...@yahoo.de>
> > >>  > > >Cc: MyFaces Discussion <us...@myfaces.apache.org>
> > >>  > > >Sent: Saturday, November 17, 2012 1:02 PM
> > >>  > > >Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to
> > > CDI
> > >>  > Managed
> > >>  > > Beans
> > >>  > > >
> > >>  > > >
> > >>  > > >Great, thanks Mark. I did download TomEE, and looking at
> > > examples
> > >>  > > (referenced on same page as TomEE downloads) and I'm looking
> > > at this
> > >>  > guide
> > >>  > > below to ensure I am injecting beans correctly.
> > >>  > > >
> > >>  > > >
> > >>  > >
> > >> http://docs.jboss.org/weld/reference/1.0.0/en-US/html/injection.html
> > >>  > > >
> > >>  > > >
> > >>  > > >
> > >>  > > >On Sat, Nov 17, 2012 at 6:50 AM, Mark Struberg
> > > <st...@yahoo.de>
> > >>  > wrote:
> > >>  > > >
> > >>  > > >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."
> > > <sm...@gmail.com>
> > >>  > > >>>To: MyFaces Discussion
> > > <us...@myfaces.apache.org>; Mark Struberg <
> > >>  > > struberg@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
> > > <st...@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."
> > > <sm...@gmail.com>
> > >>  > > >>>>> To: MyFaces Discussion
> > > <us...@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
> > >>  > > >>>>>
> > >>  > > >>>>
> > >>  > > >>>
> > >>  > > >>>
> > >>  > > >>>
> > >>  > > >>
> > >>  > > >
> > >>  > > >
> > >>  > > >
> > >>  > >
> > >>  >
> > >>
> > >
> >
>

Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

Your under windows and use @webXXX annotations? That's an issue fixed on
trunk normally.

Can you try the snapshot?
Le 17 nov. 2012 18:51, "Howard W. Smith, Jr." <sm...@gmail.com> a
écrit :

> Done. I removed JUEL (and MyFaces CODI), for now, from classpath as well as
> web.xml.
>
> FYI, with respect to writeup, how to use Juel with TomEE/OpenWebBeans, I
> used instructions at the following URL:
>
> http://tandraschko.blogspot.de/2012/08/increase-your-jsf-application.html
>
>
> Before and after removing JUEL (and MyFaces CODI), I have been getting the
> following exception in the server log:
>
> Nov 17, 2012 12:35:49 PM org.apache.tomee.catalina.OpenEJBContextConfig
> processAnnotationsFile
> SEVERE: OpenEJBContextConfig.processAnnotationsFile: failed.
> java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence
> near index 3
> C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\classes
>    ^
>
> Does this mean that I should do as Jose recommended to me earlier...add
> any/all JARs to tomee /lib folder? I am deploying via NetBeans 7.2's Deploy
> option against TomEE. Should I deploy the generated WAR file, manually, by
> dropping WAR file in tomee webapps folder instead?
>
>
> On Sat, Nov 17, 2012 at 12:31 PM, Mark Struberg <st...@yahoo.de> wrote:
>
> > Hi Howard!
> >
> > cross-posting to openejb-dev which is the community behind TomEE.
> >
> > Juel is an Expression Language library which parses the EL expressions
> and
> > invokes the various registered ELResolvers until one of them feels
> > responsible.
> >
> > TomEE (like glassfish) contains plain tomcat which has an own EL library
> > in jasper-el.
> > Please remove juel for now. We will add it back later. also comment out
> > the expression factory context-param in your web.xml.
> >
> > I'm not sure if that helps, but via remote I can only to give you tips
> > until we found the problem.
> >
> >
> > PS: TODO we gonna write up a documentation about how to use JUEL with
> > TomEE.
> >
> >
> >
> > ----- Original Message -----
> > > From: "Howard W. Smith, Jr." <sm...@gmail.com>
> > > To: MyFaces Discussion <us...@myfaces.apache.org>
> > > Cc:
> > > Sent: Saturday, November 17, 2012 5:49 PM
> > > Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI
> > Managed Beans
> > >
> > > Okay, I downloaded TomEE 1.5 plus, and trying to start the app.
> > >
> > > I have the following in my web.xml:
> > >
> > >     <context-param>
> > >
> > > <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
> > >
> > > <param-value>de.odysseus.el.ExpressionFactoryImpl</param-value>
> > >     </context-param>
> > >
> > > The error(s) below leads me to believe that I may need to remove JUEL
> > 2.2.5
> > > from my web app. Please confirm/advise.
> > >
> > > Nov 17, 2012 11:37:24 AM org.apache.catalina.loader.WebappClassLoader
> > > validateJarFile
> > > INFO:
> > >
> >
> validateJarFile(C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\juel-2.2.5.jar)
> > > - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
> > > javax/el/Expression.class
> > > Nov 17, 2012 11:37:24 AM
> > org.apache.tomee.catalina.TomEEClassLoaderEnricher
> > > validateJarFile
> > > WARNING: jar
> > >
> >
> 'C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\transaction-api-1.1.jar'
> > > contains offending class: javax.transaction.Transaction. It will be
> > ignored.
> > >
> > >
> > > Nov 17, 2012 11:37:33 AM org.apache.openejb.cdi.CdiAppContextsService
> > > lazyStartSessionContext
> > > WARNING: Could NOT lazily initialize session context because of null
> > > RequestContext
> > > Nov 17, 2012 11:37:33 AM
> > org.apache.myfaces.webapp.AbstractFacesInitializer
> > > initFaces
> > > SEVERE: An error occured while initializing MyFaces: No
> > > javax.el.ExpressionFactory found. Please provide <context-param> in
> > > web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> > > javax.faces.FacesException: No javax.el.ExpressionFactory found. Please
> > > provide <context-param> in web.xml:
> org.apache.myfaces.EXPRESSION_FACTORY
> > > at
> > >
> >
> org.apache.myfaces.webapp.FaceletsInitilializer.initContainerIntegration(FaceletsInitilializer.java:42)
> > >
> > >
> > >
> > >
> > > On Sat, Nov 17, 2012 at 11:22 AM, Gerhard Petracek <
> > > gerhard.petracek@gmail.com> wrote:
> > >
> > >>  hi jose,
> > >>
> > >>  just fyi:
> > >>  with tomee you don't need weld, because you get openwebbeans
> > >>  out-of-the-box.
> > >>
> > >>  regards,
> > >>  gerhard
> > >>
> > >>  http://www.irian.at
> > >>
> > >>  Your JSF/JavaEE powerhouse -
> > >>  JavaEE Consulting, Development and
> > >>  Courses in English and German
> > >>
> > >>  Professional Support for Apache MyFaces
> > >>
> > >>
> > >>
> > >>  2012/11/17 José Luis Cetina <ma...@gmail.com>
> > >>
> > >>  > Hi let me tell you my experience.
> > >>  > I migrate from managedbeans + mojarra + glassfish to myfaces +
> WELD +
> > >>  TomEE
> > >>  > and now I'm so happy to did so.
> > >>  >
> > >>  > Now my app use:
> > >>  > -Apache TomEE 1.5
> > >>  > -Apache MyFaces
> > >>  > -Apache CODI
> > >>  > -Primefaces 3.4.2
> > >>  > -Primefaces Mobile
> > >>  > -Primefaces Extensions 0.6.1
> > >>  > -PrettyFaces  3.3.3
> > >>  > -OpenJPA 2.2
> > >>  > -EJB
> > >>  > -JdbcRealm for login (my own query for login using any tables in my
> > > mysql
> > >>  > database).
> > >>  > -WELD
> > >>  > -And all the excellent Apache stuff
> > >>  > Etc...
> > >>  >
> > >>  > And I'm so happy with this change, the this are more easy to
> > > config, use
> > >>  > more standards, is very very fast, use myfaces and with this you
> can
> > >>  forget
> > >>  > speed issues.
> > >>  >
> > >>  > This project is a maven project, in netbeans 7.2.
> > >>  >
> > >>  > If you need some example project I can send you a simple example.
> > >>  >
> > >>  > I enhance my jpa entities so easy with maven plugin, run in every
> IDE
> > > and
> > >>  > other stuff that are excellents
> > >>  >
> > >>  > Seriously if have the opportunity and time to migrate do it now you
> > > will
> > >>  be
> > >>  > happy.
> > >>  >
> > >>  > And one tip maybe you don't need CODI at the beginning. CODI can
> > > help in
> > >>  > many things like type-safe navigations, security, validations,
> > >>   prerenders
> > >>  > events and so on.
> > >>  >
> > >>  > Al most forget to tell you the easy Way for drop your jars in lib
> > > folder
> > >>  > and with this decrease your war size, I remember in glassfish
> > > sometimes
> > >>  it
> > >>  > wasn't easy.
> > >>  >
> > >>  > I recommend you to be alert for changes and fixes in TomEE, because
> > > they
> > >>  > fix issues and update in they trunk svn everyday.
> > >>  >
> > >>  > Please suscribe to TomEE mailing lists. Rommain is a great commiter
> > > guy
> > >>  who
> > >>  > help immediately with other people.
> > >>  >
> > >>  > I hope this experience can help you.
> > >>  >
> > >>  > SCJA. Jose Luis Cetina
> > >>  > maxtorzito
> > >>  >  El 17/11/2012 06:06, "Mark Struberg"
> > > <st...@yahoo.de> escribió:
> > >>  >
> > >>  > > Hi!
> > >>  > >
> > >>  > > If you look for docs, here they are:
> > >>  > >
> > >>  > > http://tomee.apache.org/documentation.html
> > >>  > >
> > >>  > > LieGrue,
> > >>  > > strub
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > > >________________________________
> > >>  > > > From: "Howard W. Smith, Jr."
> > > <sm...@gmail.com>
> > >>  > > >To: Mark Struberg <st...@yahoo.de>
> > >>  > > >Cc: MyFaces Discussion <us...@myfaces.apache.org>
> > >>  > > >Sent: Saturday, November 17, 2012 1:02 PM
> > >>  > > >Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to
> > > CDI
> > >>  > Managed
> > >>  > > Beans
> > >>  > > >
> > >>  > > >
> > >>  > > >Great, thanks Mark. I did download TomEE, and looking at
> > > examples
> > >>  > > (referenced on same page as TomEE downloads) and I'm looking
> > > at this
> > >>  > guide
> > >>  > > below to ensure I am injecting beans correctly.
> > >>  > > >
> > >>  > > >
> > >>  > >
> > >> http://docs.jboss.org/weld/reference/1.0.0/en-US/html/injection.html
> > >>  > > >
> > >>  > > >
> > >>  > > >
> > >>  > > >On Sat, Nov 17, 2012 at 6:50 AM, Mark Struberg
> > > <st...@yahoo.de>
> > >>  > wrote:
> > >>  > > >
> > >>  > > >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."
> > > <sm...@gmail.com>
> > >>  > > >>>To: MyFaces Discussion
> > > <us...@myfaces.apache.org>; Mark Struberg <
> > >>  > > struberg@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
> > > <st...@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."
> > > <sm...@gmail.com>
> > >>  > > >>>>> To: MyFaces Discussion
> > > <us...@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
> > >>  > > >>>>>
> > >>  > > >>>>
> > >>  > > >>>
> > >>  > > >>>
> > >>  > > >>>
> > >>  > > >>
> > >>  > > >
> > >>  > > >
> > >>  > > >
> > >>  > >
> > >>  >
> > >>
> > >
> >
>

Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Done. I removed JUEL (and MyFaces CODI), for now, from classpath as well as
web.xml.

FYI, with respect to writeup, how to use Juel with TomEE/OpenWebBeans, I
used instructions at the following URL:

http://tandraschko.blogspot.de/2012/08/increase-your-jsf-application.html


Before and after removing JUEL (and MyFaces CODI), I have been getting the
following exception in the server log:

Nov 17, 2012 12:35:49 PM org.apache.tomee.catalina.OpenEJBContextConfig
processAnnotationsFile
SEVERE: OpenEJBContextConfig.processAnnotationsFile: failed.
java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence
near index 3
C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\classes
   ^

Does this mean that I should do as Jose recommended to me earlier...add
any/all JARs to tomee /lib folder? I am deploying via NetBeans 7.2's Deploy
option against TomEE. Should I deploy the generated WAR file, manually, by
dropping WAR file in tomee webapps folder instead?


On Sat, Nov 17, 2012 at 12:31 PM, Mark Struberg <st...@yahoo.de> wrote:

> Hi Howard!
>
> cross-posting to openejb-dev which is the community behind TomEE.
>
> Juel is an Expression Language library which parses the EL expressions and
> invokes the various registered ELResolvers until one of them feels
> responsible.
>
> TomEE (like glassfish) contains plain tomcat which has an own EL library
> in jasper-el.
> Please remove juel for now. We will add it back later. also comment out
> the expression factory context-param in your web.xml.
>
> I'm not sure if that helps, but via remote I can only to give you tips
> until we found the problem.
>
>
> PS: TODO we gonna write up a documentation about how to use JUEL with
> TomEE.
>
>
>
> ----- Original Message -----
> > From: "Howard W. Smith, Jr." <sm...@gmail.com>
> > To: MyFaces Discussion <us...@myfaces.apache.org>
> > Cc:
> > Sent: Saturday, November 17, 2012 5:49 PM
> > Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI
> Managed Beans
> >
> > Okay, I downloaded TomEE 1.5 plus, and trying to start the app.
> >
> > I have the following in my web.xml:
> >
> >     <context-param>
> >
> > <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
> >
> > <param-value>de.odysseus.el.ExpressionFactoryImpl</param-value>
> >     </context-param>
> >
> > The error(s) below leads me to believe that I may need to remove JUEL
> 2.2.5
> > from my web app. Please confirm/advise.
> >
> > Nov 17, 2012 11:37:24 AM org.apache.catalina.loader.WebappClassLoader
> > validateJarFile
> > INFO:
> >
> validateJarFile(C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\juel-2.2.5.jar)
> > - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
> > javax/el/Expression.class
> > Nov 17, 2012 11:37:24 AM
> org.apache.tomee.catalina.TomEEClassLoaderEnricher
> > validateJarFile
> > WARNING: jar
> >
> 'C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\transaction-api-1.1.jar'
> > contains offending class: javax.transaction.Transaction. It will be
> ignored.
> >
> >
> > Nov 17, 2012 11:37:33 AM org.apache.openejb.cdi.CdiAppContextsService
> > lazyStartSessionContext
> > WARNING: Could NOT lazily initialize session context because of null
> > RequestContext
> > Nov 17, 2012 11:37:33 AM
> org.apache.myfaces.webapp.AbstractFacesInitializer
> > initFaces
> > SEVERE: An error occured while initializing MyFaces: No
> > javax.el.ExpressionFactory found. Please provide <context-param> in
> > web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> > javax.faces.FacesException: No javax.el.ExpressionFactory found. Please
> > provide <context-param> in web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> > at
> >
> org.apache.myfaces.webapp.FaceletsInitilializer.initContainerIntegration(FaceletsInitilializer.java:42)
> >
> >
> >
> >
> > On Sat, Nov 17, 2012 at 11:22 AM, Gerhard Petracek <
> > gerhard.petracek@gmail.com> wrote:
> >
> >>  hi jose,
> >>
> >>  just fyi:
> >>  with tomee you don't need weld, because you get openwebbeans
> >>  out-of-the-box.
> >>
> >>  regards,
> >>  gerhard
> >>
> >>  http://www.irian.at
> >>
> >>  Your JSF/JavaEE powerhouse -
> >>  JavaEE Consulting, Development and
> >>  Courses in English and German
> >>
> >>  Professional Support for Apache MyFaces
> >>
> >>
> >>
> >>  2012/11/17 José Luis Cetina <ma...@gmail.com>
> >>
> >>  > Hi let me tell you my experience.
> >>  > I migrate from managedbeans + mojarra + glassfish to myfaces + WELD +
> >>  TomEE
> >>  > and now I'm so happy to did so.
> >>  >
> >>  > Now my app use:
> >>  > -Apache TomEE 1.5
> >>  > -Apache MyFaces
> >>  > -Apache CODI
> >>  > -Primefaces 3.4.2
> >>  > -Primefaces Mobile
> >>  > -Primefaces Extensions 0.6.1
> >>  > -PrettyFaces  3.3.3
> >>  > -OpenJPA 2.2
> >>  > -EJB
> >>  > -JdbcRealm for login (my own query for login using any tables in my
> > mysql
> >>  > database).
> >>  > -WELD
> >>  > -And all the excellent Apache stuff
> >>  > Etc...
> >>  >
> >>  > And I'm so happy with this change, the this are more easy to
> > config, use
> >>  > more standards, is very very fast, use myfaces and with this you can
> >>  forget
> >>  > speed issues.
> >>  >
> >>  > This project is a maven project, in netbeans 7.2.
> >>  >
> >>  > If you need some example project I can send you a simple example.
> >>  >
> >>  > I enhance my jpa entities so easy with maven plugin, run in every IDE
> > and
> >>  > other stuff that are excellents
> >>  >
> >>  > Seriously if have the opportunity and time to migrate do it now you
> > will
> >>  be
> >>  > happy.
> >>  >
> >>  > And one tip maybe you don't need CODI at the beginning. CODI can
> > help in
> >>  > many things like type-safe navigations, security, validations,
> >>   prerenders
> >>  > events and so on.
> >>  >
> >>  > Al most forget to tell you the easy Way for drop your jars in lib
> > folder
> >>  > and with this decrease your war size, I remember in glassfish
> > sometimes
> >>  it
> >>  > wasn't easy.
> >>  >
> >>  > I recommend you to be alert for changes and fixes in TomEE, because
> > they
> >>  > fix issues and update in they trunk svn everyday.
> >>  >
> >>  > Please suscribe to TomEE mailing lists. Rommain is a great commiter
> > guy
> >>  who
> >>  > help immediately with other people.
> >>  >
> >>  > I hope this experience can help you.
> >>  >
> >>  > SCJA. Jose Luis Cetina
> >>  > maxtorzito
> >>  >  El 17/11/2012 06:06, "Mark Struberg"
> > <st...@yahoo.de> escribió:
> >>  >
> >>  > > Hi!
> >>  > >
> >>  > > If you look for docs, here they are:
> >>  > >
> >>  > > http://tomee.apache.org/documentation.html
> >>  > >
> >>  > > LieGrue,
> >>  > > strub
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > > >________________________________
> >>  > > > From: "Howard W. Smith, Jr."
> > <sm...@gmail.com>
> >>  > > >To: Mark Struberg <st...@yahoo.de>
> >>  > > >Cc: MyFaces Discussion <us...@myfaces.apache.org>
> >>  > > >Sent: Saturday, November 17, 2012 1:02 PM
> >>  > > >Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to
> > CDI
> >>  > Managed
> >>  > > Beans
> >>  > > >
> >>  > > >
> >>  > > >Great, thanks Mark. I did download TomEE, and looking at
> > examples
> >>  > > (referenced on same page as TomEE downloads) and I'm looking
> > at this
> >>  > guide
> >>  > > below to ensure I am injecting beans correctly.
> >>  > > >
> >>  > > >
> >>  > >
> >> http://docs.jboss.org/weld/reference/1.0.0/en-US/html/injection.html
> >>  > > >
> >>  > > >
> >>  > > >
> >>  > > >On Sat, Nov 17, 2012 at 6:50 AM, Mark Struberg
> > <st...@yahoo.de>
> >>  > wrote:
> >>  > > >
> >>  > > >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."
> > <sm...@gmail.com>
> >>  > > >>>To: MyFaces Discussion
> > <us...@myfaces.apache.org>; Mark Struberg <
> >>  > > struberg@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
> > <st...@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."
> > <sm...@gmail.com>
> >>  > > >>>>> To: MyFaces Discussion
> > <us...@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
> >>  > > >>>>>
> >>  > > >>>>
> >>  > > >>>
> >>  > > >>>
> >>  > > >>>
> >>  > > >>
> >>  > > >
> >>  > > >
> >>  > > >
> >>  > >
> >>  >
> >>
> >
>

Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI Managed Beans

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Done. I removed JUEL (and MyFaces CODI), for now, from classpath as well as
web.xml.

FYI, with respect to writeup, how to use Juel with TomEE/OpenWebBeans, I
used instructions at the following URL:

http://tandraschko.blogspot.de/2012/08/increase-your-jsf-application.html


Before and after removing JUEL (and MyFaces CODI), I have been getting the
following exception in the server log:

Nov 17, 2012 12:35:49 PM org.apache.tomee.catalina.OpenEJBContextConfig
processAnnotationsFile
SEVERE: OpenEJBContextConfig.processAnnotationsFile: failed.
java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence
near index 3
C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\classes
   ^

Does this mean that I should do as Jose recommended to me earlier...add
any/all JARs to tomee /lib folder? I am deploying via NetBeans 7.2's Deploy
option against TomEE. Should I deploy the generated WAR file, manually, by
dropping WAR file in tomee webapps folder instead?


On Sat, Nov 17, 2012 at 12:31 PM, Mark Struberg <st...@yahoo.de> wrote:

> Hi Howard!
>
> cross-posting to openejb-dev which is the community behind TomEE.
>
> Juel is an Expression Language library which parses the EL expressions and
> invokes the various registered ELResolvers until one of them feels
> responsible.
>
> TomEE (like glassfish) contains plain tomcat which has an own EL library
> in jasper-el.
> Please remove juel for now. We will add it back later. also comment out
> the expression factory context-param in your web.xml.
>
> I'm not sure if that helps, but via remote I can only to give you tips
> until we found the problem.
>
>
> PS: TODO we gonna write up a documentation about how to use JUEL with
> TomEE.
>
>
>
> ----- Original Message -----
> > From: "Howard W. Smith, Jr." <sm...@gmail.com>
> > To: MyFaces Discussion <us...@myfaces.apache.org>
> > Cc:
> > Sent: Saturday, November 17, 2012 5:49 PM
> > Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to CDI
> Managed Beans
> >
> > Okay, I downloaded TomEE 1.5 plus, and trying to start the app.
> >
> > I have the following in my web.xml:
> >
> >     <context-param>
> >
> > <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
> >
> > <param-value>de.odysseus.el.ExpressionFactoryImpl</param-value>
> >     </context-param>
> >
> > The error(s) below leads me to believe that I may need to remove JUEL
> 2.2.5
> > from my web app. Please confirm/advise.
> >
> > Nov 17, 2012 11:37:24 AM org.apache.catalina.loader.WebappClassLoader
> > validateJarFile
> > INFO:
> >
> validateJarFile(C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\juel-2.2.5.jar)
> > - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
> > javax/el/Expression.class
> > Nov 17, 2012 11:37:24 AM
> org.apache.tomee.catalina.TomEEClassLoaderEnricher
> > validateJarFile
> > WARNING: jar
> >
> 'C:\Users\Public\NetBeansProjects\mcms\build\web\WEB-INF\lib\transaction-api-1.1.jar'
> > contains offending class: javax.transaction.Transaction. It will be
> ignored.
> >
> >
> > Nov 17, 2012 11:37:33 AM org.apache.openejb.cdi.CdiAppContextsService
> > lazyStartSessionContext
> > WARNING: Could NOT lazily initialize session context because of null
> > RequestContext
> > Nov 17, 2012 11:37:33 AM
> org.apache.myfaces.webapp.AbstractFacesInitializer
> > initFaces
> > SEVERE: An error occured while initializing MyFaces: No
> > javax.el.ExpressionFactory found. Please provide <context-param> in
> > web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> > javax.faces.FacesException: No javax.el.ExpressionFactory found. Please
> > provide <context-param> in web.xml: org.apache.myfaces.EXPRESSION_FACTORY
> > at
> >
> org.apache.myfaces.webapp.FaceletsInitilializer.initContainerIntegration(FaceletsInitilializer.java:42)
> >
> >
> >
> >
> > On Sat, Nov 17, 2012 at 11:22 AM, Gerhard Petracek <
> > gerhard.petracek@gmail.com> wrote:
> >
> >>  hi jose,
> >>
> >>  just fyi:
> >>  with tomee you don't need weld, because you get openwebbeans
> >>  out-of-the-box.
> >>
> >>  regards,
> >>  gerhard
> >>
> >>  http://www.irian.at
> >>
> >>  Your JSF/JavaEE powerhouse -
> >>  JavaEE Consulting, Development and
> >>  Courses in English and German
> >>
> >>  Professional Support for Apache MyFaces
> >>
> >>
> >>
> >>  2012/11/17 José Luis Cetina <ma...@gmail.com>
> >>
> >>  > Hi let me tell you my experience.
> >>  > I migrate from managedbeans + mojarra + glassfish to myfaces + WELD +
> >>  TomEE
> >>  > and now I'm so happy to did so.
> >>  >
> >>  > Now my app use:
> >>  > -Apache TomEE 1.5
> >>  > -Apache MyFaces
> >>  > -Apache CODI
> >>  > -Primefaces 3.4.2
> >>  > -Primefaces Mobile
> >>  > -Primefaces Extensions 0.6.1
> >>  > -PrettyFaces  3.3.3
> >>  > -OpenJPA 2.2
> >>  > -EJB
> >>  > -JdbcRealm for login (my own query for login using any tables in my
> > mysql
> >>  > database).
> >>  > -WELD
> >>  > -And all the excellent Apache stuff
> >>  > Etc...
> >>  >
> >>  > And I'm so happy with this change, the this are more easy to
> > config, use
> >>  > more standards, is very very fast, use myfaces and with this you can
> >>  forget
> >>  > speed issues.
> >>  >
> >>  > This project is a maven project, in netbeans 7.2.
> >>  >
> >>  > If you need some example project I can send you a simple example.
> >>  >
> >>  > I enhance my jpa entities so easy with maven plugin, run in every IDE
> > and
> >>  > other stuff that are excellents
> >>  >
> >>  > Seriously if have the opportunity and time to migrate do it now you
> > will
> >>  be
> >>  > happy.
> >>  >
> >>  > And one tip maybe you don't need CODI at the beginning. CODI can
> > help in
> >>  > many things like type-safe navigations, security, validations,
> >>   prerenders
> >>  > events and so on.
> >>  >
> >>  > Al most forget to tell you the easy Way for drop your jars in lib
> > folder
> >>  > and with this decrease your war size, I remember in glassfish
> > sometimes
> >>  it
> >>  > wasn't easy.
> >>  >
> >>  > I recommend you to be alert for changes and fixes in TomEE, because
> > they
> >>  > fix issues and update in they trunk svn everyday.
> >>  >
> >>  > Please suscribe to TomEE mailing lists. Rommain is a great commiter
> > guy
> >>  who
> >>  > help immediately with other people.
> >>  >
> >>  > I hope this experience can help you.
> >>  >
> >>  > SCJA. Jose Luis Cetina
> >>  > maxtorzito
> >>  >  El 17/11/2012 06:06, "Mark Struberg"
> > <st...@yahoo.de> escribió:
> >>  >
> >>  > > Hi!
> >>  > >
> >>  > > If you look for docs, here they are:
> >>  > >
> >>  > > http://tomee.apache.org/documentation.html
> >>  > >
> >>  > > LieGrue,
> >>  > > strub
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > > >________________________________
> >>  > > > From: "Howard W. Smith, Jr."
> > <sm...@gmail.com>
> >>  > > >To: Mark Struberg <st...@yahoo.de>
> >>  > > >Cc: MyFaces Discussion <us...@myfaces.apache.org>
> >>  > > >Sent: Saturday, November 17, 2012 1:02 PM
> >>  > > >Subject: Re: MyFaces 2.1.9 / Glassfish 3.1.2.2: Migrating to
> > CDI
> >>  > Managed
> >>  > > Beans
> >>  > > >
> >>  > > >
> >>  > > >Great, thanks Mark. I did download TomEE, and looking at
> > examples
> >>  > > (referenced on same page as TomEE downloads) and I'm looking
> > at this
> >>  > guide
> >>  > > below to ensure I am injecting beans correctly.
> >>  > > >
> >>  > > >
> >>  > >
> >> http://docs.jboss.org/weld/reference/1.0.0/en-US/html/injection.html
> >>  > > >
> >>  > > >
> >>  > > >
> >>  > > >On Sat, Nov 17, 2012 at 6:50 AM, Mark Struberg
> > <st...@yahoo.de>
> >>  > wrote:
> >>  > > >
> >>  > > >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."
> > <sm...@gmail.com>
> >>  > > >>>To: MyFaces Discussion
> > <us...@myfaces.apache.org>; Mark Struberg <
> >>  > > struberg@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
> > <st...@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."
> > <sm...@gmail.com>
> >>  > > >>>>> To: MyFaces Discussion
> > <us...@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
> >>  > > >>>>>
> >>  > > >>>>
> >>  > > >>>
> >>  > > >>>
> >>  > > >>>
> >>  > > >>
> >>  > > >
> >>  > > >
> >>  > > >
> >>  > >
> >>  >
> >>
> >
>