ManagedBeans are unreachable. Seam 3 + Richfaces + Glassfish 3
testvogel Feb 7, 2012 9:48 AMHi,
I'm trying to setup a Seam 3 + Richfaces app on a Glassfish 3 webserver. I'm using maven for the building process.
Currently I only try to use a really simple managed bean:
[code]
@ViewScoped
@ManagedBean
public class RichBean implements Serializable {
private static final long serialVersionUID = -6239437588285327644L;
private String name;
@PostConstruct
public void postContruct() {
name = "John";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
[/code]
index.xhtml
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j">
<body>
<ui:composition template="/templates/template.xhtml">
<ui:define name="title">RichFaces Sample</ui:define>
<ui:define name="body">
<h:form prependId="false">
<h:outputLabel value="Name:" for="nameInput" />
<h:inputText id="nameInput" value="#{richBean.name}">
<a4j:ajax event="keyup" render="output" />
</h:inputText>
<h:panelGroup id="output">
<h:outputText value="Hello #{richBean.name}!" rendered="#{not empty richBean.name}" />
</h:panelGroup>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
[/code]
The problem ist that the bean cannot be found:
[code]
WARNUNG: /index.xhtml @13,70 value="#{richBean.name}": Target Unreachable, identifier 'richBean' resolved to null
javax.el.PropertyNotFoundException: /index.xhtml @13,70 value="#{richBean.name}": Target Unreachable, identifier 'richBean' resolved to null
[/code]
This managed bean and the index.xhtml are packen in a war file. This war file is packed together with my ejb file in a ear file. The ejbs are working properly.
During startup of the app I can see that the empty beans.xml of the war file wont be read (only from the .ejb):
[code]
INFO: Solder Config XML provider starting...
INFO: Loading XmlDocumentProvider: org.jboss.solder.config.xml.bootstrap.ResourceLoaderXmlDocumentProvider
INFO: Reading XML file: file:/glassfish3/glassfish/domains/domain1/applications/core/ejb__mEjb_jar/META-INF/seam-beans.xml
INFO: Reading XML file: jar:file:/glassfish3/glassfish/domains/domain1/applications/core/lib/seam-rest-3.1.0.Final.jar!/META-INF/beans.xml
INFO: Reading XML file: jar:file:/glassfish3/glassfish/domains/domain1/applications/core/lib/seam-rest-api-3.1.0.Final.jar!/META-INF/beans.xml
[/code]
I have tried to place the beans.xml in /WEB-INF, WEB-INF/classes/META-INF and /META-INF. I think this is only a configuration issue but I dont know where I have to look for the problem.
regards,