This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes JBOSS ERROR - Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JBOSS ERROR - "Both MyFaces and the RI are on your classpath."" Watch "JBOSS ERROR - "Both MyFaces and the RI are on your classpath."" New topic
Author

JBOSS ERROR - "Both MyFaces and the RI are on your classpath."

Yaron Rel
Greenhorn

Joined: Aug 04, 2009
Posts: 20
Hi,
I jave JEE application which is deployed as ".ear" file into jboss-5.1.0.GA
My application uses JSF with SEAM 2.1.2 implementation, RichFaces 3.3.2.SR1 (you can see the full jar list in the attachment file).
I don't use any where in my code any of MyFaces/tomahawk tags. (as you can see in my web.xml configurations bellow).
This server has becide of my application, another application that uses MyFaces implementation of JSF.
uploading the server has no Errors but after my first access to my app, the server throws this error:
I will appreciate if any one has solution for that.
Thanks



Here is also my web.xml configuration:


[Download jar_list.bmp] Download

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

Unlike Tomcat, recent releases of JBoss are JEE-compliant, and that means that the JSF implementation is in the server itself, so it doesn't have to be added to the application's WAR.

If you want to use MyFaces despite this fact, there's a web.xml setting that tells JBoss to allow it. Check the JBoss documentation for details.

Note that "MyFaces" means only the MyFaces JSF core in this context. It's perfectly fine to use the JBoss (RI) faces implementation with MyFaces Tomahawk, and hopefully by now they've fixed the issues that made it not work well with Trinidad and Tobago.


Customer surveys are for companies who didn't pay proper attention to begin with.
Yaron Rel
Greenhorn

Joined: Aug 04, 2009
Posts: 20
Hi,
Thanks for your reply.
my application uses Jboss Seam that requires JSF RI (which JBOSS already holds) and not MyFaces.
I don't hold in my ".ear" file any JSF implementation because I want my application to use those of JBOSS.
When I run my app without any other app every thing goes well.
The problem starts when the other application that run on the same JBOSS (without ear file, just a folder) uses MyFaces
and then there is a conflict in the class loaders that causes my exception.
I need a way to force JBOSS to use it's JSF RI jars for my application instead of using the MyFaces jars of the other application for my application.
In the meanwhile I found some clues that might solve this:
1. The other application should be packed in ".ear" file and that the MyFaces jars will be part of the ".ear" file.
2. consider using "hierarchical classloader" (or Isolation) with JBoss (jboss-app.xml, jboss-web.xml). see also: http://community.jboss.org/wiki/ClassLoadingConfiguration
3. add the following to my application web.xml (but this wasn't enough):

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

This doesn't sound quite right. Each webapp in a J(2)EE container has its own classpath, and anything in the WEB-INF/lib and WEB-INF/classes of one webapp will not appear in the classpath of any other webapp. That's true regardless of whether you deploy WARs or EARS and whether you keep them zipped or exploded.

You can have a conflict in JSF implementations in one webapp, but that shouldn't cause conflicts in other webapps, because the implementation jar is in not in their classpaths. The only way to have a global conflict is if you put classes in the globally-shared part of the classpath, which doesn't include the internal classpaths for individual webapps.
Yaron Rel
Greenhorn

Joined: Aug 04, 2009
Posts: 20
Hi,
Thats what I think that should be, but the fact is that when I put asside the other app jars every think works fine.
also, the only place that the MyFaces jars can come from in JBOSS is only from other application because JBOSS default implementation of JSF is JSF RI and not those of apache MyFaces.
Yaron
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBOSS ERROR - "Both MyFaces and the RI are on your classpath."