问题
i've a JSF2 (Richfaces 4.1.0) project running in eclipse. I'm trying to run it on WAS 8.5 using mojarra jsf implementation (2.2.0). Then lib are provided with maven but the server seems to override them since in console i can read that Myfaces as been loaded.
i'm wondering why WAS act like this ? how to make the project use mojarra without using shared libs in was admin console ?
this is maven relevant portion of code :
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.0</version>
</dependency>
thanks in advance
回答1:
I wrote this blog to demonstrate how to make websphere 8.5 use mojarra not myfaces.
- Add the Mojarra listener to the required web.xml file.
<listener><listener-class>com.sun.faces.config.ConfigureListener</listener-class></listener>
- Add the Mojarra JSF implementation, which are javax.faces-2.1.24.jar, jsf-api-2.1.24.jar and jsf-impl-2.1.24.jar, to the Environment > Shared Libraries.
- javax.faces-2.1.24.jar (GroupId: org.glassfish)
- jsf-api-2.1.24.jar (GroupId: com.sun.faces)
- jsf-impl-2.1.24.jar (GroupId: com.sun.faces)
- After configuration shared libraries, the Websphere server must be Restart.
- After deploy your project, at the Enterprise Applications > staaec-web-1_0_10-SNAPSHOT_war(your project) > Class loader. Class loader order must be select (Classes loaded with local class loader first (parent last))
- For reference shared libraries to your project, you must go to Enterprise Applications > staaec-web-1_0_10-SNAPSHOT_war > Shared library references > Shared Library Mapping for mapping shared libraries to your project.
- Start your application.
回答2:
Check this page Configuring JavaServer Faces implementation. It explains in details what you have to configure (basically isolated shared library and configure JSF settings)
来源:https://stackoverflow.com/questions/24258561/how-to-make-websphere-8-5-use-mojarra-not-myfaces