-
1. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
zenig Oct 13, 2012 7:58 PM (in response to zenig)I am using JBoss AS 7.1.1. Could it be two different classloaders are loading SortOrder thus the casting can't happen? Is it in part due to the EAR structure?
Here are my Maven snippets:
Root POM.xml:
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${richfaces.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<version>${richfaces.version}</version>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-api</artifactId>
<version>${richfaces.version}</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
<version>${richfaces.version}</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-api</artifactId>
<version>${richfaces.version}</version>
</dependency>
EJB POM.xml:
<dependency> <groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<scope>provided</scope> </dependency>
<dependency> <groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-api</artifactId>
</dependency>
Web POM.xml:
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
-
2. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
rhanus Oct 15, 2012 5:25 AM (in response to zenig)it's obviously a classloading problem I had a similar one
check if you have richfaces libs in your deployment either in project.ear/lib or project.ear/app.war/WEB-INF/lib directory
if so then delete them and try if it helps
-
3. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
zenig Oct 15, 2012 3:39 PM (in response to rhanus)Here is where the Richfaces libs reside. I am surprised to see the different filenames. In the EAR POM file, I use a property to specify the version ( ${richfaces.version} ) which is set to 4.3.0-SNAPSHOT. The EJB and WAR POM doesn't specify a version so it should use the version from the EAR POM, right? What do I have wrong?
EAR (lib):
richfaces-components-api-4.3.0-SNAPSHOT.jar
richfaces-core-api-4.3.0-SNAPSHOT.jar
WAR (WEB-INF\lib):
richfaces-components-api-4.3.0-20121011.103434-144.jar
richfaces-components-ui-4.3.0-20121005.112837-143.jar
richfaces-core-api-4.3.0-20121005.105055-103.jar
richfaces-core-impl-4.3.0-20121005.105302-98.jar
-
4. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
rhanus Oct 16, 2012 4:42 AM (in response to zenig)The EJB and WAR POM doesn't specify a version so it should use the version from the EAR POM, right?
it depends on project pom.xml hierarchy, obviously your ear pom.xml is not connected with war pom.xm anyway
if not defined the concrete version (4.3.0-SNAPSHOT at your case) is resolved in conjunction with top-level maven config $HOME/.m2/settings.xml
What do I have wrong?
I guest you need richfaces libs only in war so you should remove ear/ejb pom richfaces dependecies and define property ${richfaces.version} in war pom.xml
as a final hint I would use latest stable version which is 4.2.2 now unless you need a specific feature/bugfix available only in snapshot
-
5. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
zenig Oct 16, 2012 12:24 PM (in response to rhanus)it depends on project pom.xml hierarchy, obviously your ear pom.xml is not connected with war pom.xm anyway
if not defined the concrete version (4.3.0-SNAPSHOT at your case) is resolved in conjunction with top-level maven config $HOME/.m2/settings.xml
Your right, I didn't explain it correctly. I have a root POM and an EAR, Web and EJB POM. The EAR, Web, and EJB POM all use the root POM as the parent. With the version defined in the root POM, I figured the child POM files would use the version specified in the root POM. I looked at $HOME/.m2/settings.xml and largely the file is commented out (out-of-the-box).
I guest you need richfaces libs only in war so you should remove ear/ejb pom richfaces dependecies and define property ${richfaces.version} in war pom.xml
as a final hint I would use latest stable version which is 4.2.2 now unless you need a specific feature/bugfix available only in snapshot
I believe I need to have richfaces in the EJB POM since I am using org.richfaces.component.SortOrder and org.richfaces.component.UICalendar. If I don't have those, then it won't compile. I explicitly specified the Richfaces version in the Web POM and it is still pulling the jar files with the timestamp, opposed to 4.3.0-SNAPSHOT like the api jars!
-
6. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
rhanus Oct 17, 2012 5:23 AM (in response to zenig)I looked at $HOME/.m2/settings.xml and largely the file is commented out (out-of-the-box).
you would need to configure your repositories following this guide
your root pom.xml should maintain following dependencies:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${richfaces.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-api</artifactId>
<scope>provided</scope>
</dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
<scope>provided</scope>
</dependency>
since you need RF libs in ejb and war module simultaneously then these libs should be located in ear/lib but ideally nowhere else
delete any richfaces dependencies from ejb and war pom.xml and in your ear pom.xml override RF deps:
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-api</artifactId>
</dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-api</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
hopefully it helps you
-
7. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
rhanus Oct 17, 2012 11:02 AM (in response to rhanus)I've just recalled a better solution:
- create a richface4 module in jboss7 as described here:
- then only your root pom.xml is supposed to maintain dependecies to richfaces libs with provided scope (delete any richfaces dependencies from ear, ejb, war ... pom.xm)
- supply ear/META-INF/jboss-deployment-structure.xml as described in the JIRA issue
as a pretty side-effect your ear will be smaller
-
8. Re: org.richfaces.component.SortOrder cannot be cast to org.richfaces.component.SortOrder
zenig Oct 20, 2012 9:55 PM (in response to rhanus)Thank you. After following your feedback, it is now working. Hopefully this can help someone else with their EAR structure and Richfaces.