users@glassfish.java.net

Re: MyFaces + Glassfish v3.1.2 + CDI

From: <edward.burns_at_oracle.com>
Date: Tue, 27 Mar 2012 12:15:15 +0000 (GMT)

JC> Hi im trying to run a project with MyFaces 2.1.6 + Glassfish 3.1.2
+
JC> CDI (Weld). My project works fine with Mojarra 2.1.6 but if i try
to
JC> run with MyFaces i get this error:

Hello Jose, and thank you for your interest in Mojarra.

JC> javax.el.PropertyNotFoundException: Target Unreachable, identifier
JC> 'indexLoginMBean' resolved to null

JC> As you can see i get a PropertyNotFoundException i see the problem
JC> is that my bean (@Named) is not injected, i have the beans.xml in
JC> META-INF i have too these 2 lines for work with myfaces, in
JC> glassfish-web.xml:

JC> <class-loader delegate="false"/>
JC> <property name="useBundledJsf" value="true"/>

JC> And i see this line: Severe: Both MyFaces and the RI are on your
JC> classpath. Please make sure to use only one of the two
JC> JSF-implementations (of course i can see in my classpath thath im
JC> using myfaces not mojarra).

As Leonardo Uribe helpfully pointed out in [1], this message is coming
from GlassFish in response to your glassfish-web.xml declaration, and
indicates that in fact the system is working as directed, as far as the
active JSF Implementation being MyFaces.

JC> Somebody can help, really this is so frustrating, and the problem
is
JC> the INJECTION of my bean:

Right, and again Leonardo is correct:

LU> The other problem you are experiencing is related to the same
LU> classloader flag. Since myfaces jars should be on WEB-INF/lib,
those
LU> jars cannot be found by weld, so to make it work, you need to use
LU> another library like OpenWebBeans and put the related jar files on
LU> WEB-INF/lib folder too. That will work but it is not ideal. Anyway,
LU> most of the people will not care about this.

I expect that the combination of GlassFish + MyFaces + Weld is the
problem. As you can see, the GlassFish team has done some work to
ensure that MyFaces can replace Mojarra as the JSF impl. I am not
certain that the same diligence has happened when you add Weld to the
mix.

JC> Resume:

JC> myfaces + glassfish 3.1.2 + CDI + beans.xml =
JC> PropertyNotFoundException (my bean annotaed with @Named) never get
JC> injected

JC> mojarra + glassfish 3.1.2 + CDI + beans.xml = Works!!

I'd like to remind you that Oracle's motto is Hardware, Software,
Complete. If you keep replacing core parts of the implementation,
first
the JSF implementation, then the CDI implementation, at some point you
have to ask why are you still using GlassFish? If we allowed replacing
the Servlet and JSP impl would you want to replace that too?

In any case, I'll forward your concern to the Oracle engineer assigned
to make sure Weld runs great in GlassFish.

Thanks,

Ed

[1]
http://mail-archives.apache.org/mod_mbox/myfaces-users/201203.mbox/%3CC
ABujnVctPy_vvk7T_9oWi-BiF063Hw6aVGuc_LLa=fxiZALuNg_at_mail.gmail.com%3E