2
Can someone help solve an exception being generated in my application?
I’m developing a Java web application, I just put one input
and a selectonemenu
in the application to try to save the data, the moment I click the save button generates the following exception:
javax.el.Propertynotfoundexception: /pages/private/message/insert_message.xhtml @34,104 value="#{messageBean.message.name}": Target Unreachable, 'null' returned 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 javax.faces.Component.UIInput.getConvertedValue(Uiinput.java:1045) at javax.faces.Component.UIInput.validate(Uiinput.java:975) at javax.faces.Component.UIInput.executeValidate(Uiinput.java:1248) 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:1258) at javax.faces.Component.UIComponentBase.processValidators(Uicomponentbase.java:1258) 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.Standardwrapper.service(Standardwrapper.java:1682) at org.apache.Catalina.core.Standardwrappervalve.invoke(Standardwrappervalve.java:318) at org.apache.Catalina.core.Standardcontextvalve.invoke(Standardcontextvalve.java:160) at org.apache.Catalina.core.Standardpipeline.doInvoke(Standardpipeline.java:734) at org.apache.Catalina.core.Standardpipeline.invoke(Standardpipeline.java:673) at com.sun.Enterprise.web.Webpipeline.invoke(Webpipeline.java:99) at org.apache.Catalina.core.Standardhostvalve.invoke(Standardhostvalve.java:174) at org.apache.Catalina.connector.Coyoteadapter.doService(Coyoteadapter.java:415) at org.apache.Catalina.connector.Coyoteadapter.service(Coyoteadapter.java:282) at com.sun.Enterprise.v3.services.impl.Containermapper$Httphandlercallable.call(Containermapper.java:459) at com.sun.Enterprise.v3.services.impl.ContainerMapper.service(Containermapper.java:167) at org.glassfish.Grizzly.http.server.HttpHandler.runService(Httphandler.java:201) at org.glassfish.Grizzly.http.server.HttpHandler.doHandle(Httphandler.java:175) at org.glassfish.Grizzly.http.server.HttpServerFilter.handleRead(Httpserverfilter.java:235) at org.glassfish.Grizzly.filterchain.Executorresolver$9.execute(Executoresolver.java:119) at org.glassfish.Grizzly.filterchain.Defaultfilterchain.executeFilter(Defaultfilterchain.java:284) at org.glassfish.Grizzly.filterchain.Defaultfilterchain.executeChainPart(Defaultfilterchain.java:201) at org.glassfish.Grizzly.filterchain.Defaultfilterchain.execute(Defaultfilterchain.java:133) at org.glassfish.Grizzly.filterchain.Defaultfilterchain.process(Defaultfilterchain.java:112) at org.glassfish.Grizzly.ProcessorExecutor.execute(Processorexecutor.java:77) at org.glassfish.Grizzly.nio.transport.TCPNIOTransport.fireIOEvent(Tcpniotransport.java:561) at org.glassfish.Grizzly.strategies.Abstractiostrategy.fireIOEvent(Abstractiostrategy.java:112) at org.glassfish.Grizzly.strategies.Workerthreadiostrategy.run0(Workerthreadiostrategy.java:117) at org.glassfish.Grizzly.strategies.Workerthreadiostrategy.access$100(Workerthreadiostrategy.java:56) at org.glassfish.Grizzly.strategies.Workerthreadiostrategy$Workerthreadrunnable.run(Workerthreadiostrategy.java:137) at org.glassfish.Grizzly.threadpool.Abstractthreadpool$Worker.doWork(Abstractthreadpool.java:565) at org.glassfish.Grizzly.threadpool.Abstractthreadpool$Worker.run(Abstractthreadpool.java:545) at java.lang.Thread.run(Thread.java:745) Caused by: javax.el.Propertynotfoundexception: Target Unreachable, 'null' returned null at com.sun.el.parser.Astvalue.getTarget(Astvalue.java:192) at com.sun.el.parser.Astvalue.getType(Astvalue.java:86) at com.sun.el.ValueExpressionImpl.getType(Valueexpressionimpl.java:201) at org.jboss.Weld.el.Weldvalueexpression.getType(Weldvalueexpression.java:93) at com.sun.faces.facelets.el.TagValueExpression.getType(Tagvalueexpression.java:98) ... 41 more
Here is my xhtml page:
<div class="row">
<div class="col-sm-12">
<label class="control-label">#{bundle['system.ui.label.name']}</label>
<h:inputText id="message" styleClass="form-control"
value="#{messageBean.message.name}" />
</div>
</div>
And here my managedBean:
@ManagedBean(name = "messageBean")
@SessionScoped
public class MessageBean {
private List<Message> listMessage;
private Message message;
private List<Category> listCategory;
private List<Type> listType;
@EJB
private MessageFacade messageFacade;
@EJB
private CategoryFacade categoryFacade;
@EJB
private TypeFacade typeFacade;
@PostConstruct
public void init(){
listAllMessage();
listAllCategory();
listAllType();
}
public void insert(){
try {
message.getUser().getDsUsername();
System.out.println("Usuario: "+message.getUser().getDsUsername());
messageFacade.save(message);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Nome" +message.getName());
System.out.println("Categoria"+ message.getCategory().getName());
System.out.println("Tipo"+ message.getType().getName());
System.out.println("Data"+ message.getRegistrationInstant());
System.out.println("Usuario"+ message.getUser().getDsUsername());
}
public void listAllMessage() {
listMessage = messageFacade.listAllMessage();
}
public void listAllCategory() {
listCategory = categoryFacade.listAllCategory();
}
public void listAllType(){
listType = typeFacade.listAllType();
}
public List<Category> getListCategory() {
listAllCategory();
return listCategory;
}
public void setListCategory(List<Category> listCategory) {
this.listCategory = listCategory;
}
public List<Message> getListMessage() {
listAllMessage();
return listMessage;
}
public void setListMessage(List<Message> listMessage) {
this.listMessage = listMessage;
}
public List<Type> getListType() {
listAllType();
return listType;
}
public void setListType(List<Type> listType) {
this.listType = listType;
}
public Message getMessage() {
return message;
}
public void setMessage(Message message) {
this.message = message;
}
}
Where you assign some reference to
message
?– Bruno César