JSF 2.1.0 WAR getting deployed in Jboss Fuse 6.1. But cannot perform actions
bharani.r.kanth Feb 16, 2015 8:51 AMI have tried deploying JSF 2.1.0 war in jboss fuse 6.1, I could successfully deploy it.
I could also see webpages rendering in the browser. when i navigate through localhost:8181/{name given for Web-ContextPath}
but the problem arises when I click on button to perform some action. For example If I click on Login button.
I get the following exception.
Target Unreachable, identifier 'loginBean' resolved to null
javax.el.PropertyNotFoundException: /login.xhtml @29,97 value="#{loginBean.userName}": Target Unreachable, identifier 'loginBean' resolved to null
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)[299:org.glassfish.com.sun.faces:2.1.0.FCS]
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)[299:org.glassfish.com.sun.faces:2.1.0.FCS]
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1030)[300:org.glassfish.javax.faces:2.1.0.FCS]
at javax.faces.component.UIInput.validate(UIInput.java:960)[300:org.glassfish.javax.faces:2.1.0.FCS]
at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)[300:org.glassfish.javax.faces:2.1.0.FCS]
at javax.faces.component.UIInput.processValidators(UIInput.java:698)[300:org.glassfish.javax.faces:2.1.0.FCS]
at javax.faces.component.UIForm.processValidators(UIForm.java:253)[300:org.glassfish.javax.faces:2.1.0.FCS]
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)[300:org.glassfish.javax.faces:2.1.0.FCS]
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1172)[300:org.glassfish.javax.faces:2.1.0.FCS]
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)[299:org.glassfish.com.sun.faces:2.1.0.FCS]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)[299:org.glassfish.com.sun.faces:2.1.0.FCS]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)[299:org.glassfish.com.sun.faces:2.1.0.FCS]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)[300:org.glassfish.javax.faces:2.1.0.FCS]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
Dependencies I used in the pom.xml
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.web</groupId>
<artifactId>pax-web-jsp</artifactId>
<version>3.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Web-ContextPath>${project.artifactId}</Web-ContextPath>
<Bundle-ClassPath>.,WEB-INF/classes,{maven-dependencies}</Bundle-ClassPath>
<Export-Package>!*</Export-Package>
<Import-Package>${import.packages}</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
<Private-Package>${private.packages}</Private-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<strong>
<archiveClasses>true</archiveClasses>
</strong>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<webResources>
<resource>
<directory>src/main/resources</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>**.*</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
faces-config.xml
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
version="2.1">
<lifecycle>
<phase-listener>com.test.CustomPhaseListener</phase-listener>
</lifecycle>
</faces-config>
and my LoginBean
@ManagedBean
@SessionScoped
public class LoginBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
final static Logger logger = Logger.getLogger(LoginBean.class);
private String userName;
private String password;
public String login()
{
blah blah blah logic
}
public String logout()
{
blah blah logic
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
and my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>helloworld-ui</display-name>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Welcome page -->
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
I have also deployed jsf-api,jsf-impl 2.1.0 in the fuse container.
[ 299] [Active ] [ ] [ ] [ 60] Mojarra JSF Implementation 2.1.0 (20110303-FCS) (2.1.0.FCS)
[ 300] [Active ] [ ] [ ] [ 60] Mojarra JSF API Implementation 2.1.0 (20110303-FCS) (2.1.0.FCS)
Can you guys please help me where am I doing wrong.
Regards,
Bharani