JSF Managed bean in jar not instantiated - jsf

I have created two jsf projects in JSF. One of them is a base project that has a single session bean. This base project is packaged into a .jar file (with a /META-INF/faces-config.xml file) and included in the other project (the clientproj). The problem is that when I run the client project, the session bean in the base project is not instantiated, and I get a NullPointerException.
Details are as follows:
Base Project - Session Bean
package sbeans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
#ManagedBean
#SessionScoped
public class SessionBean {
private String myName;
public String getMyName()
{
return this.myName;
}
public void setMyName(String newName)
{
this.myName = newName;
}
public String getResult()
{
return "result";
}
}
The META-INF/faces-config.xml file in this project is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
(The META-INF folder is under the WebContent folder).
This project is exported as a .jar file named sbeans.jar (using eclipse) by right clicking on th project --> export --> export --> jar file.
Now there is a client project where sbeans.jar is placed in the WEB-INF/lib folder. The client project has a single bean as follows:
package clientproj;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import sbeans.SessionBean;
#ManagedBean
public class ClientBean {
#ManagedProperty("#{sessionBean}") private SessionBean sessionBean;
private String name;
public String getName()
{
System.out.println("clientBean.getName() - this.sessionBean = " + this.sessionBean);
this.name = this.sessionBean.getMyName();
return this.name;
}
public void setName(String newName)
{
this.name = newName;
System.out.println("clientBean.setName() - this.sessionBean = " + this.sessionBean);
this.sessionBean.setMyName(this.name);
}
public void setSessionBean(SessionBean sBean)
{
this.sessionBean = sBean;
}
}
The client project has a test.xhtml as follows:
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Some Title</title>
</h:head>
<h:body>
<h:form>
<h:outputLabel value="Enter Your Name" for="name"></h:outputLabel>
<br></br>
<h:inputText value="#{clientBean.name}"></h:inputText>
<h:commandButton value="Go" action="#{sessionBean.getResult}"> </h:commandButton>
</h:form>
</h:body>
</html>
When I try to run test.xhtml (on tomcat, within eclipse), I get an exception as follows (presumably due the sessionBean being null (see text in bold)):
Feb 22, 2015 12:50:02 AM com.sun.faces.renderkit.html_basic.HtmlBasicRenderer getForComponent
WARNING: Unable to find component with ID name in view.
**clientBean.getName() - this.sessionBean = null**
Feb 22, 2015 12:50:02 AM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SEVERE: Error Rendering View[/test.xhtml]
javax.el.ELException: /test.xhtml #18,41 value="#{clientBean.name}": Error reading 'name' on type clientproj.ClientBean
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:174)
at javax.faces.component.UIInput.getValue(UIInput.java:291)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.el.ELException: Error reading 'name' on type clientproj.ClientBean
at javax.el.BeanELResolver.getValue(BeanELResolver.java:110)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
... 40 more
Caused by: java.lang.NullPointerException
at clientproj.ClientBean.getName(ClientBean.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:99)
... 45 more
Feb 22, 2015 12:50:02 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/clientproj] threw exception [null] with root cause
java.lang.NullPointerException
at clientproj.ClientBean.getName(ClientBean.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:99)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:174)
at javax.faces.component.UIInput.getValue(UIInput.java:291)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
BTW, there is also a simple result.xhtml in the client project as follows:
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Result</title></h:head>
<h:body>
<h1>Result</h1>
<h2>
<h:outputText value="#{clientBean.name}"></h:outputText>
</h2>
</h:body>
</html>
The original project where I need this working is a lot more complicated than this. What I have posted here is the crux of the issue I am facing. I have struggled with this for quite a few hours, and have tried many different methods to get this working. Any help will be much appreciated.
Thanks
Mahendra

Looks like Base project - the one with session bean is not correctly exported. JSF requires faces-config.xml to be placed in sbeans.jar directly in META-INF directory. However, according to your description Base project is a web project. When I created such project and exported it using the way you did I got the following structure:
sbeans.jar
|--META-INF (empty)
|--WebContent
|--META-INF
|--faces-config.xml
As you see faces-config.xml is placed in wrong place.
To fix this either:
change project type to plain java - you anyway export it as JAR not WAR, don't you? (looks like the only way to do it is to create new project from scratch). Then you can then use the following hint https://stackoverflow.com/a/11027541/1071508 to generate WAR with all dependencies with only few mouse clicks.
if changing project type is not possible consider converting projects to maven so that you take advantage of plugins. Then you can rename the WAR during creation: Renaming Maven dependency in WAR's WEB-INF/lib folder
if previous solution is not possible for some reason
create META-INF in Java Resources/src and place faces-config.xml there
or export project as WAR and rename it to .jar after exporting

Related

NPE during navigation with viewscoped bean using Mojarra 2.2.x with openwebbeans 1.0 (CDI 1.0)

I am now running into a ViewScope issue on h:commandButton with navigation.
I am not sure if JSF 2.2 is supported with CDI 1.0
Error
May 28, 2020 5:57:07 PM com.sun.faces.context.ExceptionHandlerImpl throwIt
INFO: Exception when handling error trying to reset the response.
java.lang.NullPointerException
at com.sun.faces.application.view.ViewScopeContextManager.destroyBeans(ViewScopeContextManager.java:171)
at com.sun.faces.application.view.ViewScopeContextManager.clear(ViewScopeContextManager.java:122)
at com.sun.faces.application.view.ViewScopeManager.processPreDestroyViewMap(ViewScopeManager.java:335)
at com.sun.faces.application.view.ViewScopeManager.processEvent(ViewScopeManager.java:240)
at com.sun.faces.application.view.ViewScopeEventListener.processEvent(ViewScopeEventListener.java:68)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:294)
at javax.faces.component.UIViewRoot$ViewMap.clear(UIViewRoot.java:1850)
at com.sun.faces.application.NavigationHandlerImpl.clearViewMapIfNecessary(NavigationHandlerImpl.java:432)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:249)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:183)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Minimal, Reproducible Example in a Tomcat 8.5 environment
test.xhtml -> "ajax working" button works , "h:commandButton non-ajax" button fails
Fails with Mojarra version jsf-api-2.2.13 & jsf-impl-2.2.13
Fails with Mojarra version javax.faces-2.2.20
Works with myfaces version myfaces-api-2.2.12 and myfaces-impl-2.2.12
Works with omnifaces version omnifaces-1.8.3 org.omnifaces.cdi.ViewScoped (addition jar validation-api-1.1.0.Final was required to be added)
TestView.java
package com.lean.demo;
import java.io.Serializable;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
#Named
#ViewScoped
public class TestView implements Serializable {
public String goNextCase1() {
System.out.println("goNextCase1");
// Add navigation-case with <redirect />
return "PageTestView2";
}
public String goNextCase2() {
System.out.println("goNextCase2");
return "test2.xhtml?faces-redirect=true";
}
public String goNextCase3() {
System.out.println("goNextCase3");
return "test2.xhtml";
}
}
test.xhtml
<!DOCTYPE html>
<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">
<h:head>
<title>Mojarra JSF 2.2 with openwebbeans 1.1.0 (CDI 1.0)</title>
</h:head>
<h:body>
<h:form id="frmTest">
<h2>
<h:commandButton value="Case 1" action="#{testView.goNextCase1()}">
</h:commandButton>
</h2>
<h2>
<h:commandButton value="Case 2" action="#{testView.goNextCase2()}">
</h:commandButton>
</h2>
<h2>
<h:commandButton value="Case 3" action="#{testView.goNextCase3()}">
</h:commandButton>
</h2>
</h:form>
</h:body>
</html>
Jars in Lib
commons-beanutils-1.9.2.jar
commons-collections-3.2.2.jar
commons-digester-1.8.jar
commons-logging-1.1.1.jar
geronimo-atinject_1.0_spec-1.0.jar
geronimo-interceptor_1.1_spec-1.0.jar
geronimo-jcdi_1.0_spec-1.0.jar
javassist-3.12.0.GA.jar
jsf-api-2.2.13.jar
jsf-impl-2.2.13.jar
openwebbeans-impl-1.1.0.jar
openwebbeans-jsf-1.1.0.jar
openwebbeans-resource-1.1.0.jar
openwebbeans-spi-1.1.0.jar
openwebbeans-web-1.1.0.jar
scannotation-1.0.2.jar

add primefaces mobile to project

i made this jsf page with primefaces 5.2 and it works
<!DOCTYPE html>
<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:p="http://primefaces.org/ui"
xmlns:pm="http://primefaces.org/mobile">
<f:view renderKitId="PRIMEFACES_MOBILE" />
<h:head>
</h:head>
<h:body>
<pm:page id="first">
<pm:header title="Page 1"></pm:header>
<pm:content>
<p>Multiple pages</p>
<h:form>
<p:button outcome="pm:second?transition=flip" value="Go Button" />
</h:form>
</pm:content>
</pm:page>
<pm:page id="second">
<pm:header title="Page 2"></pm:header>
<pm:content>
<p>Page 2 content.</p>
</pm:content>
<h:form>
<p:button outcome="pm:first?transition=slidefade" value="Go Button" />
</h:form>
</pm:page>
</h:body>
</html>
primefaces version on my project is 4 and i cant change it, Apparently it hasnt mobile version on it
so i downloaded primefaces mobile from here and added to project,but i get this error
SEVERE: Error Rendering View[/hl/nursing/patientdocserviceform.xhtml]
java.lang.NullPointerException
at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:184)
at com.sun.faces.application.view.WriteBehindStateWriter.write(WriteBehindStateWriter.java:127)
at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.write(HtmlResponseWriter.java:717)
at org.primefaces.mobile.component.page.PageRenderer.encodeBegin(PageRenderer.java:64)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:864)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1894)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1899)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1899)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:451)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.omnifaces.facesviews.FacesViewsForwardingFilter.doFilter(FacesViewsForwardingFilter.java:121)
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
i added code to faces-config,changed mobile version but none of them didnt work
what am i doing wrong?

JSF page with internationalization - javax.el.PropertyNotFoundException: Target Unreachable, identifier 'index' resolved to null [duplicate]

This question already has answers here:
Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable
(18 answers)
Closed 7 years ago.
I want to implement simple JSF page based on this tutorial with JSF 2.2
faces-config.xml
<?xml version="1.0"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>es</supported-locale>
</locale-config>
<resource-bundle>
<base-name>com.web.common.internationalization.text</base-name>
<var>text</var>
</resource-bundle>
</application>
</faces-config>
index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="#{index.language}"
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view locale="#{index.locale}">
<h:head>
</h:head>
<h:body>
<h:form>
<h:selectOneMenu value="#{index.language}" onchange="submit()">
<f:selectItem itemValue="en" itemLabel="English" />
<f:selectItem itemValue="es" itemLabel="Spanish" />
</h:selectOneMenu>
</h:form>
<address class="top-address">
<span><h:outputText value="#{text['customer.support']}" /></span>
</address>
</h:body>
</f:view>
</html>
CDI Bean
import java.io.Serializable;
import java.util.Locale;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.inject.Named;
#Named
#SessionScoped
public class Index implements Serializable
{
private Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
public Locale getLocale()
{
return locale;
}
public String getLanguage()
{
return locale.getLanguage();
}
public void setLanguage(String language)
{
this.locale = new Locale(language);
}
}
I added here Text Java Class from the tutorial and the properties files.
But for some reason when I open the web page I get error code 500. Do you have any idea where I'm wrong?
Error stack:
javax.el.PropertyNotFoundException: /index.xhtml #15,80 value="#{index.language}": Target Unreachable, identifier 'index' resolved to null
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectOneValue(MenuRenderer.java:201)
at com.sun.faces.renderkit.html_basic.MenuRenderer.getConvertedValue(MenuRenderer.java:318)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1046)
at javax.faces.component.UIInput.validate(UIInput.java:976)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1249)
at javax.faces.component.UIInput.processValidators(UIInput.java:712)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'index' resolved to null
You got the wrong import - the #SessionScoped is from the faces package, it should be the one from the javax.enterprise.context package.
Or you can switch #Named to #javax.faces.bean.ManagedBean, then the #SessionScoped will match (it will no longer be a CDI bean though).

Omnifaces library in JSF, Java classpath Cannot find type

I try to recover the constants in my xhtml jsf in using Omnifaces library, but when I run my project I get:
Cannot find type 'fr.epsi.utils.ConstantsPages' in classpath.
Here is my xhtml page :
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:o="http://omnifaces.org/ui">
<o:importConstants type="fr.epsi.utils.ConstantsPages" />
<h:head>
<title>Acceuil</title>
<h:outputStylesheet name="css/style.css"/>
</h:head>
<h:body>
<h:panelGrid columns="3" cellpadding="10">
<h:link value="Home" outcome="#{ConstantsPages.LOGIN_PAGE}" />
</h:panelGrid>
<h:body>
</html>
And my ConstantsPages class :
package fr.epsi.utils;
public class ConstantsPages {
/* GENERAL */
public static final String LOGIN_PAGE = "/General/login";
public static final String LOGIN_CLIENT_PAGE = "/General/loginClient";
public static final String LOGIN_TECHNICIEN_PAGE = "/General/loginTechnicien";
public static final String ACCUEIL_PAGE = "/General/accueil";
}
And the stack trace :
java.lang.IllegalArgumentException: Cannot find type 'fr.epsi.utils.ConstantsPages' in classpath.
at org.omnifaces.taghandler.ImportConstants.toClass(ImportConstants.java:173)
at org.omnifaces.taghandler.ImportConstants.collectConstants(ImportConstants.java:134)
at org.omnifaces.taghandler.ImportConstants.apply(ImportConstants.java:117)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:774)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: fr.epsi.utils.ConstantsPages
at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:808)
at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:696)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at org.omnifaces.taghandler.ImportConstants.toClass(ImportConstants.java:156)
... 36 more
Please help me!
You need to make sure that the class file is properly compiled and placed in webapp's runtime classpath. E.g. as /WEB-INF/classes/fr/epsi/utils/ConstantsPages.class inside the WAR.
This exception says that it is not. There's really no other cause. If you're using an IDE, make sure that the class file is inside Java source folder of the web project and that you've cleaned, rebuilt and redeployed the project and restarted the server.

Retrieving the value of the selected item in a SelectOneMenu List

i just want to retrieve the login of the selected User in the SelectOneMenu List
here's the code :
My xhtml page :
<?xml version="1.0" encoding="UTF-8"?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>JSF 2.0 Test</title>
</h:head>
<h:body>
<h3>JSF 2.0 Test</h3>
<h:form>
<br></br>
<p:commandButton id="modalDialogButton" value="Modal" onclick="dlg2.show();"
type="button"/>
<p:dialog id="modalDialog" header="Modal Dialog" widgetVar="dlg2" modal="true"
height="100">
<h:outputText value="This is a Modal Dialog." />
<p:selectOneMenu value="#{adminMB.selectedUser}" converter="userConverter"
effect="fade">
<f:selectItem itemLabel="Choose Administor" />
<f:selectItems value="#{adminMB.users}" var="user" itemValue="#{user}"
itemLabel="#{user.userLogin}" />
</p:selectOneMenu>
<p:commandButton id="Add" value=" Add " actionListener="#
{adminMB.createProject}"></p:commandButton>
</p:dialog>
</h:form>
</h:body>
</html>
The adminMB.createProject method :
public void createProject(ActionEvent actionEvent){
System.err.println("created project admin login :"+this.selectedUser.getUserLogin());
}
The UserConverter Class :
package tn.talan.testFramework.converter;
import java.util.ArrayList;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import org.objectweb.salome_tmf.data.User;
import org.objectweb.salome_tmf.ihm.admin.AdministrationFinal;
import tn.talan.testFramework.managedBean.AdminMB;
#FacesConverter (value="userConverter")//(forClass= AdminMB.class)
public class UserConverter implements Converter {
#Override public Object getAsObject(FacesContext context, UIComponent component,
String value) {
User selectedUser = null;
ArrayList<User> usersList;
String userLogin;
AdministrationFinal administration=new AdministrationFinal();
administration.onInit();
usersList = administration.getAllUsers();
if (usersList!=null){
for(int i=0 ;i<usersList.size();i++)
{ selectedUser=usersList.get(i);
userLogin=selectedUser.getLoginFromModel();
System.err.println(userLogin);
if (userLogin==value)
return userLogin;
}
}
return null;
}
#Override
public String getAsString(FacesContext context, UIComponent component, Object value)
{
if (value == null) return "";
return ((User) value).getUserLogin();
}
}
So when i click on the "Add" button , the createProject method of the AdminMB Bean is invoked and i'm getting this error :
Error output:
26 août 2012 13:58:52 javax.faces.event.MethodExpressionActionListener processAction
GRAVE: Réception de 'java.lang.NullPointerException' lors de l'invocation du listener d'action '#{adminMB.createProject}' du composant 'Add'
26 août 2012 13:58:52 javax.faces.event.MethodExpressionActionListener processAction
GRAVE: java.lang.NullPointerException
at tn.talan.testFramework.managedBean.AdminMB.createProject(AdminMB.java:205)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:264)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:144)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
at javax.faces.component.UICommand.broadcast(UICommand.java:296)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1255)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:334)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
26 août 2012 13:58:52 com.sun.faces.context.AjaxExceptionHandlerImpl log
GRAVE: JSF1073 : javax.faces.event.AbortProcessingException intercepté durant le traitement de INVOKE_APPLICATION 5 : UIComponent-ClientId=j_idt8:Add, Message=/primeFacesDialog.xhtml #31,97 actionListener="#{adminMB.createProject}": java.lang.NullPointerException
26 août 2012 13:58:52 com.sun.faces.context.AjaxExceptionHandlerImpl log
GRAVE: /primeFacesDialog.xhtml #31,97 actionListener="#{adminMB.createProject}": java.lang.NullPointerException
javax.faces.event.AbortProcessingException: /primeFacesDialog.xhtml #31,97 actionListener="#{adminMB.createProject}": java.lang.NullPointerException
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:178)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
at javax.faces.component.UICommand.broadcast(UICommand.java:296)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1255)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:334)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
If the selected value is being converted successfully as you've implied in your conversation above, the next available culprit is your managed bean. Specifically, the scope of your managed bean. If you're using a #RequestScoped bean, you're certain to run into problems like this. Change your bean to a #ViewScoped and see what happens
replace public void createProject(ActionEvent actionEvent){ with
public void createProject(){
System.out.println(selectedUser});
}
and add process="modalDialog" to your button

Resources