6 Replies Latest reply on Nov 2, 2011 12:06 AM by Jason Porter

    Solder and Exceptions

    zeeman Novice

      I'm using latest Seam and Solder. I have below exception handler:



      @HandlesExceptions
      public class ExceptionsHandler {
      public void securityHandler(@Handles CaughtException<BaseSecurityException> event) {
      //do something with error
           }
      }
      



      In some service class a BaseSecurityException gets thrown. Above handler handles it, why does it get logged in AS7 logs? I did not write it to the log in the handler.


      First I tried firing the exception as an event, but above handler was not getting called. Then I used throw new BaseSecurityException() and that gets caught by the handler. What am I missing?


      Thanks!

        • 1. Re: Solder and Exceptions
          Jason Porter Master

          Really depends on what's doing the logging (check the class in the logs that's doing the logging). The times I've seen this it's JSF doing the logging when it shouldn't.

          • 2. Re: Solder and Exceptions
            zeeman Novice

            I use Richfaces 4.1.M3, Seam3 3.1.beta4, AS 7.0.1.



            A page calls a method on a bean, that beans throws a security exception (NotLoggedInException is a subclass of BaseSecurityException). In solder I have exception handler as in my original post. I don't log the error. But it still makes it to the server log. I just redirect to an error page in handler using externalcontext.redirect(error.xhtml).



            My stack trace and what gets logged:


            12:23:58,490 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-5) Error Rendering View[/messages/messages.xhtml]: javax.el.ELException: /messages/listMessageThreads.xhtml @18,84 rendered="#{fn:length(messagesHomeAction.memberMessageThreads)==0}": Problems calling function 'fn:length'
                 at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:193) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:421) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:297) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1652) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:853) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1652) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163) [prettyfaces-jsf2-3.3.0.jar:]
                 at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118) [prettyfaces-jsf2-3.3.0.jar:]
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:110) [prettyfaces-jsf2-3.3.0.jar:]
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.1.0.Beta3.jar:]
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:72) [solder-impl-3.1.0.Beta3.jar:]
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]
                 at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]
                 at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
            Caused by: javax.el.ELException: com.myproject.exceptions.NotLoggedInException
                 at javax.el.BeanELResolver.getValue(BeanELResolver.java:307) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]
                 at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 at org.apache.el.parser.AstValue.getValue(AstValue.java:134) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.el.parser.AstFunction.getValue(AstFunction.java:101) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.el.parser.AstEqual.getValue(AstEqual.java:37) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
                 at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                 at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
                 ... 61 more
            Caused by: com.myproject.exceptions.NotLoggedInException
                 at com.myproject.action.messaging.MessagesHomeAction.getMemberMessageThreads(MessagesHomeAction.java:55) [classes:]
                 at com.myproject.action.messaging.1018935164$Proxy$_$$_WeldSubclass.getMemberMessageThreads(1018935164$Proxy$_$$_WeldSubclass.java) [classes:]
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_24]
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
                 at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
                 at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:112) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
                 at org.jboss.interceptor.proxy.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:119) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
                 at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:152) [seam-transaction-3.1.0.Beta4.jar:]
                 at org.jboss.seam.transaction.Work.workInTransaction(Work.java:49) [seam-transaction-3.1.0.Beta4.jar:]
                 at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:148) [seam-transaction-3.1.0.Beta4.jar:]
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_24]
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
                 at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
                 at org.jboss.interceptor.proxy.InterceptorInvocation$InterceptorMethodInvocation.invoke(InterceptorInvocation.java:72) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
                 at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:82) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
                 at org.jboss.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:133) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
                 at org.jboss.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:112) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
                 at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:65) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                 at com.myproject.action.messaging.1018935164$Proxy$_$$_WeldSubclass.getMemberMessageThreads(1018935164$Proxy$_$$_WeldSubclass.java) [classes:]
                 at com.myproject.action.messaging.MessagesHomeAction$Proxy$_$$_WeldClientProxy.getMemberMessageThreads(MessagesHomeAction$Proxy$_$$_WeldClientProxy.java) [classes:]
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_24]
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
                 at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
                 at javax.el.BeanELResolver.getValue(BeanELResolver.java:302) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]
            
            

            • 3. Re: Solder and Exceptions
              Jason Porter Master

              Yep, like I said above it's JSF:


              12:23:58,490 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-5)



              It's a bug in Mojarra that only was recently fixed, AS 7.0.2 may have that fixed version, but I know 7.0.1 does not. I traced down the offending line of code earlier, but have since forgotten where it was.

              • 4. Re: Solder and Exceptions
                zeeman Novice

                I can sleep better at night now, it was driving me crazy. I'll wait for 7.1. Is it supposed to be out in Nov?

                • 5. Re: Solder and Exceptions
                  Jason Porter Master

                  I don't believe so, it will probably be January, possibly late December. I haven't followed all that closely. You could try with 7.0.2. I don't remember if it includes a version with the fix.

                  • 6. Re: Solder and Exceptions
                    Jason Porter Master

                    You could also mute that category from the logs (may be a bit drastic though)