Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Both MyFaces and the RI are on your classpath.

 
Shasi Mitra
Ranch Hand
Posts: 101
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
Shasi Mitra
Ranch Hand
Posts: 101
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 101
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic