14

Can JSF 2.0 be used with WebSphere Application Server version 7.x?

If so, how?

Web Devie
  • 1,207
  • 1
  • 13
  • 30
Dm.
  • 141
  • 1
  • 1
  • 3

8 Answers8

13

The WebSphere Infocenter indicates that the right way to change to an alternative JSF implementation is to create a WebSphere Shared Library with the isolated classloader option enabled.

Any modules that need JSF 2 would be associated with the new shared library, and then the application would start with JSF 2 instead of JSF 1.2.

It is also necessary to have fix pack 7.0.0.19 or later installed.

Community
  • 1
  • 1
RDean
  • 131
  • 1
  • 3
  • You talk about information provided on the IBM Infocenter site, but you don't provide a link. Why? – Christopher Parker Aug 27 '10 at 16:04
  • 6
    http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/tweb_jsf.html – Rick Apr 05 '11 at 16:23
  • Maybe I'm doing something wrong, but this did not work for me. When I do follow those instructions, it's still trying to load the SUN JSF-1.2 reference implementation. – Ian McLaird Sep 21 '11 at 16:29
  • OK, I got it. I needed to run some fixpacks for WAS and make sure that the JSF version was at least 2.0.4. Now it's working. +1 – Ian McLaird Sep 21 '11 at 19:44
  • @Ian McLaird, can you share what you did step by step, I'm having a hard time I get HttpSession not found after creating a shared library? what jars do you put on your shared library? – setzamora Dec 05 '11 at 04:59
  • 1
    @Joset, It's now been so long that I don't remember all the steps, but the two jars that I used were jsf-api.jar and jsf-impl.jar, with the versions that I listed in my previous comment. I needed WAS 7.0.0.19 and JSF 2.0.4 or later. – Ian McLaird Dec 15 '11 at 17:16
0

Step by step setting MyFaces 2.0 on WebSphere Application Server v7 as shared library as IBM recommends: http://wasbehindtheglass.blogspot.co.uk/

I have applied similar steps for Majorra/JSF 2.0.4 and created a shared library using only jsf-api.jar and jsf-impl.jar. As @Ian McLaird has told WAS 7.0.0.19 and JSF 2.0.4 are required. JSF 2.1.x requires Servlet 3 and is not supported by WAS7

iyildiz
  • 48
  • 5
  • And if your are using RAD and you don't want to change set the shared library from WAS7 admin console each time you deploy the application, then you can include a deployment descriptor (named as deployment.xml) in your project which sets the shared library. See the link for details: http://www.webspheretools.com/sites/webspheretools.nsf/docs/How%20to%20set%20the%20class%20loading%20policy%20to%20parent%20last%20using%20configuration%20files%20shipped%20within%20the%20EAR – iyildiz Apr 20 '12 at 16:11
  • Have you tried with MyFaces 2.1 or you're writing that it won't work basing on other source? If so, could you post it? – Danubian Sailor Jan 08 '13 at 15:29
0

My Experience:

-> WAS 7.0.0.11 on Windows

-> javax.faces-2.0.11.jar in WEB-INF/lib of my War application

-> WAS Shared librairies with javax.faces-2.0.11.jar with Isolated Class Loader

-> WAS Shared librairies associated with my War App

-> No change on Class Loader for instance and application (PARENT_FIRST)

With this conf (above) the application works fine with JSF 2.0 on WAS 7. if i delete the javax.faces-2.0.11.jar from my War app, it doesn't works.

Community
  • 1
  • 1
Mikolaj
  • 190
  • 1
  • 11
0

Following worked for me

  • Create a shared library and put your JSF 2.0 jars in it.
  • Also add EL 2.2 API and EL-Impl 2.2 jars as well since JSF 2.0 implicitly needs this.
  • Add this library to your application and make classloader preference as PARENT_LAST.

Change web.xml as following

 <context-param>
                <param-name>com.sun.faces.expressionFactory</param-name>
                <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
    </context-param>
    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

Thats it .

0

Websphere ships with JSF 1.2.something and it loads that by default. To use a different JSF library (or any other library that WS provides such as commons-logging) you need to change the way the classloader prioritizes locations. They call it 'parent last" meaning load your libs then the WS versions.

0

Hi I could run my website using this libraries

librerias

Configuring in web.xml of my project

 <context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

Configuring in websphere to load my libraries (Parent Last)

Regards

DuSant
  • 970
  • 12
  • 25
0

Thank you guys!

It worked with a newer version of javax.faces. See the maven dependencies:

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.1.29-08</version>
    </dependency>
    <dependency>
        <groupId>javax.el</groupId>
        <artifactId>el-api</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>com.sun.el</groupId>
        <artifactId>el-impl</artifactId>
        <version>2.2</version>
    </dependency>

Don't forget to add the following in your web.xml:

<context-param>
   <param-name>com.sun.faces.expressionFactory</param-name>
   <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

And finally change the WebSphere class loader order of the application and the module to the (parent last) settings: https://www.ibm.com/support/knowledgecenter/SSAW57_7.0.0/com.ibm.websphere.nd.doc/info/ae/ae/urun_rclassloader_inst.html

Regards

Laurent
  • 16
  • 1
0

I've been struggling to solve this for days. Here's how I solved it.

Use the following library: javax.faces-2.1.7.jar

If you are on PrimeFaces 3.1: primefaces-3.1.1.jar

Application Server instance: Class Loading - Parent Last

Enterprise Application instance (war Module): Class Loading - Parent Last

Make sure to remove all Servlet Container libraries such as those needed by Tomcat.

setzamora
  • 3,560
  • 6
  • 34
  • 48