JSF component bindings and EAR classloader
mechtatel Sep 3, 2009 7:21 AMHi,
I'm trying to implement a dynamic HtmlDropDownMenu, so from the view in a facelet I have the next code:
<a4j:form> <rich:dropDownMenu binding="#{mDevice.menu}" value="File" /> </a4j:form>
This is the seam component:
@Name("mDevice") @Scope(ScopeType.EVENT) @AutoCreate public class MDevice implements Serializable { private HtmlDropDownMenu menu; public HtmlDropDownMenu getMenu() { menu = new HtmlDropDownMenu(); HtmlOutputLabel hol = new HtmlOutputLabel(); HtmlOutputText hot = new HtmlOutputText(); hot.setValue("Some text"); HtmlGraphicImage hgi = new HtmlGraphicImage(); hgi.setUrl("img/some_image.gif"); hgi.setStyle("vertical-align: bottom;"); hol.getChildren().add(hot); hol.getChildren().add(hgi); menu.getFacets().put("label", hol); HtmlMenuItem hmi = new HtmlMenuItem(); hmi.setValue("Some text"); menu.getChildren().add(hmi); hmi = new HtmlMenuItem(); hmi.setValue("Another text"); menu.getChildren().add(hmi); return menu; } public void setMenu(HtmlDropDownMenu menu) { this.menu = menu; } }
Mi problem start with the fact that I'm using a EAR. The project was created with the seam-gen, so as richfaces-ui.jar and richfaces-impl.jar can be found in WAR/WEB-INF/lib (as I can read this is because of architecture decision, separating layers, fine).
On the other hand the seam component mDevice is located in a package in ejbModule and can't see richfaces-ui.jar and richfaces-impl.jar so on build is advertising the missing classes.
I try adding the reference to the richfaces-ui.jar and richfaces-impl.jar from the WAR to the java build path of the ejb. That doesn't work, because of initialization were created two instances of each jar, so ERROR is raised related with org.jboss.seam.servlet.SeamListener.
My question is, what is the better way to resolve this, without much changes on the the classloader configuration and maintaining the layer structure as possible?