HtmlTabPanel class cast exception
milesif Nov 30, 2007 6:25 PMHi everybody,
In my xhtml page I have the following line
<rich:tabPanel id="myId" binding="#{form.tabPanel}" />
and in the form backing bean I put the following code
private HtmlTabPanel panel; public void setTabPanel(UIComponent panel) { if(this.panel == null) { this.panel = (HtmlTabPanel) panel; HtmlTab tab = new HtmlTab(); tab.setTitle("Tab 1"); tab.setDisabled(false); HtmlTab tab1 = new HtmlTab(); tab1.setTitle("Tab 2"); tab1.setDisabled(false); tab.setParent(this.panel); this.panel.getChildren().add(tab); tab1.setParent(this.panel); this.panel.getChildren().add(tab1); } } public UIComponent getTabPanel() { return panel; }
I added three modules
<module> <ejb>richfaces-ui.jar</ejb> </module> <module> <ejb>richfaces-impl.jar</ejb> </module> <module> <ejb>richfaces-api.jar</ejb> </module>
in my application.xml, I put the corresponding jars in the base directory of my ear file and I removed richfaces-ui.jar and richfaces-impl.jar from the WEB-INF/lib dir of my war.
When I load the page I get
GRAVE: Error Rendering View[/dojo_comp_ext.xhtml] javax.faces.FacesException: javax.el.ELException: /dojo_comp_ext.xhtml @38,55 binding="#{form.tabPanel}": Error writing 'tabPanel' on type it.romi.ui.Form_$$_javassist_0 at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:240) at org.jboss.seam.jsf.SeamApplication.createComponent(SeamApplication.java:327) at com.sun.facelets.tag.jsf.ComponentHandler.createComponent(ComponentHandler.java:224)
caused by
Caused by: javax.el.ELException: /dojo_comp_ext.xhtml @38,55 binding="#{form.tabPanel}": Error writing 'tabPanel' on type it.romi.ui.Form_$$_javassist_0 at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:101) at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:237) ... 68 more Caused by: java.lang.ClassCastException: org.richfaces.component.html.HtmlTabPanel cannot be cast to org.richfaces.component.html.HtmlTabPanel at it.romi.ui.Form.setTabPanel(Form.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
I also looked in the manifest of those jars and found out they have
Specification-Version: 3.1.2.GA and Implementation-Version: 3.1.2.GA.
I generated the project with Seam-gen 2.0.0GA. I also searched jboss-4.2.1.GA for conflicting richfaces jars, but I did not found any.
Any idea about what is going on?
Thanks in advance,
ciao Francesco