Error Weld 2.2.8 Wrapping Exception Incorrectly
ignacio.ayuste Dec 22, 2014 5:47 PMHi Guys, im using
- RichFaces 4.5.1.Final
- Weld 2.2.8.Final
- Mojarra 2.1.29
- JSF 2.1
The problem is when im starting to use template with Facelets and an exception is thrown in this case obviously NullPointerException but if you see the stacktrace is wrapping the exception into another exception and i cant see the real cause of the problem, the original exception. Is important to say that if i coment the NPE code works perfectly. Any ideas that was causing the issue, Facelets, JSF or Weld. this happen with all exception
I have this structure:
Controller
@Named(value="productoController") @ConversationScoped public class ProductoController { public void alta(){ String test = null; //Throw NPE test.concat(""); } }
Page:
<!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:ui="http://java.sun.com/jsf/facelets" xmlns:templates="http://java.sun.com/jsf/composite/templates"> <ui:composition template="/templates/TemplateABM.xhtml"> <ui:define name="title"> #{msgs['producto.abm.alta.pagina.titulo']} </ui:define> <ui:define name="top"> <h1>#{msgs['producto.abm.alta.titulo']}</h1> </ui:define> <ui:define name="content"> <templates:productos id="templateProductos" page="alta" disableComponents="false" btnAccionText="#{msgs['comun.abm.boton.guardar']}" btnAccion="#{productoController.alta()}" /> </ui:define> </ui:composition> </html>
Template:
<!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:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:o="http://omnifaces.org/ui" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:templates="http://java.sun.com/jsf/composite/templates" > <!-- INTERFACE --> <composite:interface> <composite:attribute name="page" required="true" /> <composite:attribute name="btnAccionText" required="true" /> <composite:attribute name="btnAccion" method-signature="java.lang.String action()" required="true" /> <composite:attribute name="disableComponents" required="true" /> </composite:interface> <!-- IMPLEMENTATION --> <composite:implementation> <f:metadata> <f:event type="preRenderView" listener="#{productoController.iniciarConversacion}" /> </f:metadata> <h:form id="formABMProducto"> <h:panelGrid id="datosProducto" columns="4"> <h:outputLabel value="#{msgs['producto.abm.nombre']}" for="nombre" rendered="true" /> <h:inputTextarea id="nombre" value="#{productoController.producto.nombre}" cols="63" rows="2" rendered="true" /> <rich:message for="nombre" rendered="true" /> <h:panelGroup rendered="true" /> <h:outputLabel value="#{msgs['producto.abm.descripcion']}" for="descripcion" rendered="true"/> <h:inputTextarea id="descripcion" value="#{productoController.producto.descripcion}" cols="63" rows="4" rendered="true" /> <rich:message for="descripcion" rendered="true"/> <h:panelGroup rendered="true"/> </h:panelGrid> <templates:botonera id="templateBotonera" margen="8%" page="#{cc.attrs.page}" btnAccionText="#{cc.attrs.btnAccionText}" btnAccion="#{cc.attrs.btnAccion}" /> </h:form> </composite:implementation> </html>
stacktrace:
GRAVE: javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: Método no hallado: com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap@33704fed.btnAccion() at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101) at javax.faces.component.UICommand.broadcast(UICommand.java:315) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251) 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:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) 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 ar.com.filter.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:35) 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:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) 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:408) 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:316) 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.MethodNotFoundException: Método no hallado: com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap@33704fed.btnAccion() at org.apache.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:259) at org.apache.el.parser.AstValue.invoke(AstValue.java:271) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) at com.sun.faces.facelets.el.ContextualCompositeMethodExpression.invoke(ContextualCompositeMethodExpression.java:187) at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:450) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
Thanks Ignacio