This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Both MyFaces and the RI are on your classpath. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Both MyFaces and the RI are on your classpath. " Watch "Both MyFaces and the RI are on your classpath. " New topic
Author

Both MyFaces and the RI are on your classpath.

Shasi Mitra
Ranch Hand

Joined: Nov 27, 2008
Posts: 101

I'm getting the following error when i tried to use the MyFaces implementation of JSF.
Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.
Even after changing the class loading policy of war to ParentLast too the problem persists.
Can anybody suggest a solution for this?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

"Shasi Y",

Welcome to the JavaRanch! We don't have many rules around here, but we do require that you use a proper display name. Could you correct it, please? Information on what we need can be found at http://www.javaranch.com/name.jsp

You didn't say so, but you're probably trying to run JSF on JBoss. JBoss has a copy of the JSF RI built into it. You can find detailed information on this problem by doing a Google search, although I think the JBoss website has something on how to handle it as well.

Basically, you have to either override the use of MyFaces core or switch from MyFaces core to the Reference Implementation, which in JBoss mostly means removing the myfaces jsf-impl.jar from your WAR and letting the builtin RI classes handle the JSF core tag functionality. Since they're part of the standard, any core classes should be equivalent regardelss of whether it's MyFaces or the Sun RI.

If you're using Tomahawk or one of the other MyFaces advanced features, they stay the same. Only the core tag jar is a problem.


Customer surveys are for companies who didn't pay proper attention to begin with.
Shasi Mitra
Ranch Hand

Joined: Nov 27, 2008
Posts: 101

Thanks for the response.
We are using myfaces framework in an application deployed in WAS 6.0 server.

WAS 6.0 library files already has a jar w.r.t JSF implementation and its provided by SUN-RI. Hence when the server gets started SUN-RI implementation is loaded in the classpath.

Since our application is using Apache Myfaces implementation, we have loaded the respective myfaces library files are loaded in WEB-INF/lib folder and set "PARENT_LAST" for our webmodule to make sure the apache myfaces jar always comes first in the classpath.

But on starting the application we get the following error-
"Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations".

In spite of the above error we were able to launch our application and screens without any issues.
My concern is whether we will end up having some issue in future since we have two JSF implementation jars in our classpath. Whether any of you have used Myfaces in websphere 6.0? Is there a work around such a way that only apache myfaces jar reside in the classpath. Note that modifying websphere libraray or using share library path is ruled out as our websphere server is used by multiple applications
A. Dusi
Ranch Hand

Joined: Sep 27, 2004
Posts: 114
Shasi, My application set up is exactly like yours and I get that warning message too but only when the first JSF page is requested. My app has been running for almost 2 years with no issues at all other than this warning. I would like to hear from others how they eliminated it.
Shasi Mitra
Ranch Hand

Joined: Nov 27, 2008
Posts: 101

Hey Dusi,
This question is unrelated to the one I posted before..Do you think MyFaces is better than Sun's Reference Implementation?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Sorry I didn't reply to your private email. Yesterday was busy. I really prefer to give answers on the JavaRanch, though where everyone can benefit from the knowledge.

I believe that since it's part of the JEE spec, the JSF core class implementations are required to be provided by the server, so the answer is the same as for JBoss. Simply don't include the myfaces-impl.jar in your WAR and let the server provide the implementation. If you're testing on Tomcat and deploying on WAS or JBoss, you'll need 2 different builds (or to add the MyFaces implementation to the server lib directory).

I avoided the Sun RI for quite a long while, because it didn't seem to be fully functional, but the recent versions are OK, and some say its better than MyFaces. I haven't done any serious studies of reliability or performance, but I'm now happy with the Sun RI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Both MyFaces and the RI are on your classpath.
 
Similar Threads
MyFaces vs. RichFaces
Both MyFaces and the RI are on your classpath.
Beginner tutorial fail
dataTable styling question
JSF Configuration problem