i have a simple ear file that includes a war. I have only one Named- Bean and one xhtml. On glassfish all works fine. But on websphere it does not works. I does not works mean all EL- Tag will be ignored. I can reproduce this in glassfish when i delete my beans.xml in /WEB- INF. I tried to put the beans.xml in every single folder.
And i read this (http://www.ibm.com/developerworks/websphere/techjournal/1301_stephen/1301_stephen.html):
The beans.xml file must be placed in one of these locations: For a library JAR, EJB JAR, application client JAR or RAR archive, it needs to be in the META-INF directory. The WEB-INF/classes directory of a WAR. For a directory in the JVM classpath containing classes, the code will be scanned if the beans.xml file is located the META-INF sub-directory.
But nothing works. When i use @ManagedBean and Faces Session Scope instead all works fine. I don't know what i can do else. Please help.
Here my example code and my structures:
XHTML:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form id="tableform">
<h:outputText value="TEST"/>
<h:outputText value="#{personBean.helloWorld}"/>
<p:commandButton value="#{personBean.helloWorld}"/>
</h:form>
</h:body>
</html>
Bean:
@Named
@SessionScoped
public class PersonBean implements Serializable{
private String helloWorld;
@PostConstruct
public void init() {
setHelloWorld("HELLO WORLD");
}
public String getHelloWorld() {
return helloWorld;
}
public void setHelloWorld(String helloWorld) {
this.helloWorld = helloWorld;
}
}
Structure:
Ear -Meta-Inf --Application.xml -WAR --WEB-INF ---beans.xml
But i tried to put it in WEB-INF/classes, META-INF, META-INF from ear. Nothing works. :(
Result on Glassfish with beans.xml:
Result on Websphere / Glassfish without beans.xml:
I get no exception or error or something else.