Topic
  • 7 replies
  • Latest Post - ‏2016-02-23T14:42:21Z by XU6H_Declan_Jones
SystemAdmin
SystemAdmin
6420 Posts

Pinned topic MyFaces 2.1.8/9/10 and @Inject

‏2013-02-25T17:15:34Z |
Hey there

I need one of the mentioned versions (2.1.8 / 9 or 10) of MyFaces running in a WAS 8.5.0.1. So I created a shared library, changed the apps JSF implementation to SunRI1.2 and everything seems to work just fine:

[2/25/13 18:05:27:340 CET] 000000ab WASAxis2Exten I   WSWS7037I: The /CustomerService URL pattern was configured 

for the ch.hslu.edu.enapp.enappdaemon.web.resource.webservice.Customer servlet located in the EnappDaemonWeb.war web module. [2/25/13 18:05:27:632 CET] 000000ab WebContainerL I WebContainerLifecycle startApplication OpenWebBeans Container is starting... [2/25/13 18:05:27:813 CET] 000000ab BeansDeployer I BeansDeployer validateInjectionPoints All injection points were validated successfully. [2/25/13 18:05:27:816 CET] 000000ab WebContainerL I WebContainerLifecycle startApplication OpenWebBeans Container has started, it took [183] ms. [2/25/13 18:05:27:832 CET] 000000ab DefaultFacesC I   Reading standard config META-INF/standard-faces-config.xml [2/25/13 18:05:27:956 CET] 000000ab DefaultFacesC I   Reading config /WEB-INF/faces-config.xml [2/25/13 18:05:29:114 CET] 000000ab DefaultFacesC I   Reading config : wsjar:file:/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/EnappDaemon.ear/EnappDaemonWeb.war/WEB-INF/lib/omnifaces-1.3.jar!/META-INF/faces-config.xml [2/25/13 18:05:29:126 CET] 000000ab LogMetaInfUti I   Artifact myfaces-api was found in version 2.1.9 from path file:/home/enapp/workspace/myfaces/myfaces-api-2.1.9.jar [2/25/13 18:05:29:127 CET] 000000ab LogMetaInfUti I   Artifact myfaces-impl was found in version 2.1.9 from path file:/home/enapp/workspace/myfaces/myfaces-impl-2.1.9.jar


The only thing not working is CDI with @Inject (it does with @EJB and also when I use the WAS internal version of MyFaces).

What am I missing?

Thanks in advance.

Greetings
Joe
Updated on 2013-02-26T10:12:38Z at 2013-02-26T10:12:38Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    6420 Posts

    Re: MyFaces 2.1.8/9/10 and @Inject

    ‏2013-02-26T09:58:15Z  
    Ok, kind of "solved" it (or better found a workaround till 8.5.0.2 is released). The problem is the AnnotationProvider which needs to be added from the IBM myfaces implementation. To accomplish this a few changes are requried in the myfaces-2.1.x-impl.jar (see http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/tweb_jsf_annotation.html):
    1. substitute the services directory in downloaded myfaces-2.1.x-impl.jar with the one in {WAS_HOME}\plugins\com.ibm.ws.jsf.myfaces.jar
    2. move the com.ibm.* packages into myfaces-2.1.x-impl.jar
    3. add all additional classes from {WAS_HOME}\plugins\com.ibm.ws.jsf.myfaces.jar org.apache.myfaces.shared_impl to myfaces-2.1.x-impl.jar
    4. pack the jar: jar cvfm myfaces-impl-2.1.x.jar META-INF\MANIFEST.MF *

    Add those two params to your web.xml:
    
    <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener>   <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name> <param-value>true</param-value> </context-param>
    


    Deploy the needed libraries as WAS shared library and everything works just fine. I even added omnifaces and tomahawk and my project works perfectly.

    Greetings
    Joe
  • SystemAdmin
    SystemAdmin
    6420 Posts

    Re: MyFaces 2.1.8/9/10 and @Inject

    ‏2013-02-26T10:12:38Z  
    Ok, kind of "solved" it (or better found a workaround till 8.5.0.2 is released). The problem is the AnnotationProvider which needs to be added from the IBM myfaces implementation. To accomplish this a few changes are requried in the myfaces-2.1.x-impl.jar (see http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/tweb_jsf_annotation.html):
    1. substitute the services directory in downloaded myfaces-2.1.x-impl.jar with the one in {WAS_HOME}\plugins\com.ibm.ws.jsf.myfaces.jar
    2. move the com.ibm.* packages into myfaces-2.1.x-impl.jar
    3. add all additional classes from {WAS_HOME}\plugins\com.ibm.ws.jsf.myfaces.jar org.apache.myfaces.shared_impl to myfaces-2.1.x-impl.jar
    4. pack the jar: jar cvfm myfaces-impl-2.1.x.jar META-INF\MANIFEST.MF *

    Add those two params to your web.xml:
    <pre class="jive-pre"> <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name> <param-value>true</param-value> </context-param> </pre>

    Deploy the needed libraries as WAS shared library and everything works just fine. I even added omnifaces and tomahawk and my project works perfectly.

    Greetings
    Joe
    Damn, what have I to do, to edit my post? And why does the input link thing not work? Anyways, under 1. there should be "substitute the *META-INF/*services directory"
  • fkorenschi
    fkorenschi
    3 Posts

    Re: MyFaces 2.1.8/9/10 and @Inject

    ‏2013-05-16T12:53:17Z  
    Damn, what have I to do, to edit my post? And why does the input link thing not work? Anyways, under 1. there should be "substitute the *META-INF/*services directory"

    Hi there, i know i'm a bit off topic, but did you manage to use a JSF 2 implementation (2.0 or 2.1, MyFaces or JSFRI, doesn't matter so much) but more recent than the 2.0.2 that comes in WAS 8.0 with Websphere Portal 8 ?

    I've seen so many advices that seem to work with WAS alone, or with Websphere Portal 7, but things have changed a lot in respect to how the portlet bridge is packaged ... and nothing seems to work for me.

    Thanks a lot

  • swarley
    swarley
    1 Post

    Re: MyFaces 2.1.8/9/10 and @Inject

    ‏2013-05-16T18:43:23Z  

    Hi there, i know i'm a bit off topic, but did you manage to use a JSF 2 implementation (2.0 or 2.1, MyFaces or JSFRI, doesn't matter so much) but more recent than the 2.0.2 that comes in WAS 8.0 with Websphere Portal 8 ?

    I've seen so many advices that seem to work with WAS alone, or with Websphere Portal 7, but things have changed a lot in respect to how the portlet bridge is packaged ... and nothing seems to work for me.

    Thanks a lot

    Hi

    Sorry I never used Portal 8... so can't help you there.

    Greetings

    Joe

  • Michael Glauche
    Michael Glauche
    1 Post

    Re: MyFaces 2.1.8/9/10 and @Inject

    ‏2014-04-24T12:14:43Z  
    • swarley
    • ‏2013-05-16T18:43:23Z

    Hi

    Sorry I never used Portal 8... so can't help you there.

    Greetings

    Joe

    Hi,

    i did try your setup with Websphere 8.5.5.1, but it does not seem to work anymore :(

    CDI seems working, openWebBeans is scanning the beans and is also discovering my JSF @Named beans. (ExtendedMessage: isManagedBean for class de.glauche.SomeBean returning true)

    But, EL lookups seem to be not working, i can't access the SomeBean from an xhtml page ( #{someBean} would return null)

    Any Ideas what might be causing that?

    Also, i'm always getting an FFDC with "java.lang.IllegalStateException: Unsupported JSF Implementation used with JCDI", although looking at the code it seems more like a warning, OWB does seem to continue to initialize itself...

  • Medioman92
    Medioman92
    3 Posts

    Re: MyFaces 2.1.8/9/10 and @Inject

    ‏2014-09-22T15:52:28Z  

    This bug it's also present with Mojarra's jsf implementation...see this related topic

    no one from IBM seems to care about it :S

  • XU6H_Declan_Jones
    XU6H_Declan_Jones
    1 Post

    Re: MyFaces 2.1.8/9/10 and @Inject

    ‏2016-02-23T14:42:21Z  

    Hi Guys,

    I'm migrating from JSF MyFaces 1.2 with Tomahawk and Trinidad to MyFaces 2.X

     

    I'm running WAS 8.5.5.8 and I modified my myfaces-impl-2.1.17.jar as suggested above

     

    Replaced /META-INF/services in myfaces-impl-2.1.17.jar with the corresponding services folder from com.ibm.ws.jsf.myfaces.jar 

    Added the  com.ibm.* packages from  com.ibm.ws.jsf.myfaces.jar to the jar myfaces-impl-2.1.17.jar 

    Added the files missing from org.apache.myfaces.shared_impl in myfaces-impl-2.1.17.jar  with com.ibm.ws.jsf.myfaces.jar org.apache.myfaces.shared_impl (over laying any duplicate files)

    I replaced my existing myfaces-impl-2.1.17.jar  im my Shared Library with this new jar containing myfaces +ibm packages and services for annotations..

    Still I have the same issue as when I used the original myfaces-impl-2.1.17.jar --  Target Unreachable, identifier 'model' resolved to null

     

    The targets work fine with the MyFaces supplied with WAS 8.5.5.4 - I needed the updated version of DefaultFaceletsStateManagementStrategy with CHECK_ID_PRODUCTION_MODE

     

    I find it bizarre that this issue still exists in WAS 8.5.5.8 and the workaround does not appear to work in this instance.. Do we know if there since has been any alternative ways around this?

     

    Thanks

    Declan

     

     

     

     

     

     

     

     

    Updated on 2016-02-23T15:05:34Z at 2016-02-23T15:05:34Z by XU6H_Declan_Jones