8 Replies Latest reply on Jan 27, 2012 9:40 AM by daniel.branco

    JBoss 5 Avoid printing some exception thrown.

    daniel.branco Newbie

      Hello @ll,

       

      First I must say that I'm beginner, and I'm not in charge of the JBoss configuration so maybe I'm looking for something that can be done but I'm using the wrong words.

       

      This is my situation: We are using JBoss 5, we have a Bean which is trying to query a record and in case of not return a record, an exception is thrown with a message and not treated inside jboss, this cause at the very end of the workflow that the JBoss caught that exception and print it in the server.log. This bean is being called from other application outside JBoss; and in this application if an exception, that we are expecting, is thrown then we will catch it and treat it.

       

      What we want is to avoid printing that exception in the server.log, because whilst is true that is not being treated inside the JBoss it is expected and treated outside it.

       

      NOTE: The policy of the project is that if there is nothing found then thrown a <Record>NotFoundException, where Record is the name of the table we are trying to read e.g. EmployeeNotFoundException, and not returned a null value or other value. This has been working always like this, so I won't change the policy.

       

      Thanks in advance and kind regards,

      Daniel Branco.

        • 1. Re: JBoss 5 Avoid printing some exception thrown.
          jaikiran pai Master

          Daniel, welcome to the forums!

           

          I've moved this thread to a more appropriate forum.

           

           

          Daniel Branco wrote:

           

           

           

          What we want is to avoid printing that exception in the server.log, because whilst is true that is not being treated inside the JBoss it is expected and treated outside it.

          Can you please post the entire exception stacktrace and the associated log message from the server.log? That will give us an idea about who's logging it and possible ways to disable it.

          • 2. Re: JBoss 5 Avoid printing some exception thrown.
            daniel.branco Newbie

            Hi jaikiran,

             

            As you have requested this is the whole stack trace:

             

            2012-01-18 21:11:54,074 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] (http-0.0.0.0-8080-53) SOAP request exception

             

            com.mindergy.neo.billing.exception.TransactionNotFoundException: Open Transaction not found for code=gsgetgwap196, countryId=55, transactionTypeId=1

                    at com.mindergy.neo.billing.core.bo.TransactionBO.getOpenTransactionByCodeCountryAndType(TransactionBO.java:407)

                    at com.mindergy.neo.billing.ejb.TransactionBean.getOpenTransactionByCodeCountryAndType(TransactionBean.java:219)

                    at sun.reflect.GeneratedMethodAccessor629.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                    at java.lang.reflect.Method.invoke(Method.java:597)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

                    at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)

                    at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)

                    at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)

                    at sun.reflect.GeneratedMethodAccessor451.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                    at java.lang.reflect.Method.invoke(Method.java:597)

                    at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)

                    at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_1896973799.invoke(InvocationContextInterceptor_z_fillMethod_1896973799.java)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)

                    at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_1896973799.invoke(InvocationContextInterceptor_z_setup_1896973799.java)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)

                    at org.jboss.ejb3.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:114)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:306)

                    at org.jboss.ejb3.stateless.StatelessContainer.invokeEndpoint(StatelessContainer.java:662)

                    at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:96)

                    at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)

                    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)

                    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)

                    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)

                    at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)

                    at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)

                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

                    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

                    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)

                    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

                    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

                    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

                    at java.lang.Thread.run(Thread.java:619)

            Caused by: com.mindergy.neo.billing.exception.CodeOpenTransactionNotFoundException: CodeOpenTransactionDAO.getCodeOpenTransactionByCodeCountryAndTransactionType: countryId = '55', transactionTypeId = '1', code = 'gsgetgwap196'

                    at com.mindergy.neo.billing.core.dao.CodeOpenTransactionDAO.getCodeOpenTransactionByCodeCountryAndTransactionType(CodeOpenTransactionDAO.java:73)

                    at com.mindergy.neo.billing.core.bo.CodeOpenTransactionBO.getCodeOpenTransactionByCodeCountryAndTransactionType(CodeOpenTransactionBO.java:81)

                    at com.mindergy.neo.billing.ejb.CodeOpenTransactionBean.getCodeOpenTransactionByCodeCountryAndTransactionType(CodeOpenTransactionBean.java:78)

                    at sun.reflect.GeneratedMethodAccessor631.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                    at java.lang.reflect.Method.invoke(Method.java:597)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

                    at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)

                    at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)

                    at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)

                    at sun.reflect.GeneratedMethodAccessor451.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                    at java.lang.reflect.Method.invoke(Method.java:597)

                    at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)

                    at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_1896973799.invoke(InvocationContextInterceptor_z

            _fillMethod_1896973799.java)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)

                    at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_1896973799.invoke(InvocationContextInterceptor_z_setu

            p_1896973799.java)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)

                    at org.jboss.ejb3.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:114)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)

                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                    at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:176)

                    at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:216)

                    at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)

                    at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)

                    at $Proxy894.getCodeOpenTransactionByCodeCountryAndTransactionType(Unknown Source)

                    at sun.reflect.GeneratedMethodAccessor630.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                    at java.lang.reflect.Method.invoke(Method.java:597)

                    at com.mindergy.servicelocator.delegate.GenericDelegate$ServiceProxyHandler.invoke(GenericDelegate.java:137)

                    at $Proxy894.getCodeOpenTransactionByCodeCountryAndTransactionType(Unknown Source)

                    at com.mindergy.neo.billing.delegate.CodeOpenTransactionDelegate.getCodeOpenTransactionByCodeCountryAndTransactionType(CodeOpenTransactionDelegate

            .java:47)

                    at com.mindergy.neo.billing.core.bo.TransactionBO.getOpenTransactionByCodeCountryAndType(TransactionBO.java:403)

                    ... 78 more

             

            Thanks in advance and kind regards,

            Daniel Branco.

            • 3. Re: JBoss 5 Avoid printing some exception thrown.
              Wolf-Dieter Fink Master

              com.mindergy.neo.billing.exception.CodeOpenTransactionNotFoundException

              looks like an application Exception ...?

              • 4. Re: JBoss 5 Avoid printing some exception thrown.
                daniel.branco Newbie

                Hello Wolf,

                 

                Maybe I didn't explain myself as I expect XD. I will try to reformulate what I want to setup, understand and/or take action.

                 

                I have two application one J2EE(inside the JBoss) and a second one, J2SE in my case, outside the JBoss.

                 

                The J2EE application is just trying to retrieve and/or insert a record according to a set of parameters, by team policy if there is no way to insert and/or retrieve a record then we throw an Exception which means that we are never returning null or any other data just an Exception. My actual situation is that the J2SE application is requesting to insert/get to the J2EE application a record, if this is not possible the J2SE application is expecting the Exception thrown by the J2EE and take action.

                 

                What I need is just to, in this controlled case, throw the Exception in the J2EE application and avoid the JBoss to print this unnecessary stack trace, even when it is true that the J2EE application is not treating the Exception the fact is that is being treated by the J2SE and I'm expecting that.

                 

                So my question is, how can I avoid printing the stacktrace in JBoss using a configuration and/or Exception Handler?

                 

                Thanks to @ll in advance and Kind regards,

                Daniel Branco.

                • 5. Re: JBoss 5 Avoid printing some exception thrown.
                  Wolf-Dieter Fink Master

                  AFAIK you can throw a Application- or BusinessException (not RuntimeEx) in this case JBoss will not log the stacktrace (might depend on the JBoss version).

                  But you might take care of the transaction, it is not rolled back. But in your case there is no difference because it is a query.

                  • 6. Re: JBoss 5 Avoid printing some exception thrown.
                    daniel.branco Newbie

                    Hello Wolf,

                     

                    Thanks for your help, but I'm still not understanding, so let me ask you something.

                     

                    Maybe It is my lack of experience, but what do you mean with Application or BusinessException? Is it a type of exception? I found this annotation @javax.ejb.ApplicationException and don't know if you're referring to this. Or do you mean an ordinary exception that have nothing to do with RuntimeException? If this is the case the TransactionNotFoundException --extends--> TransactionNotFoundException --extends--> Exception; and the CodeOpenTransactionNotFoundException also extends from the same set of classes so maybe could be the JBoss version?

                     

                    Sorry for bothering you and thanks in advance for your help.

                     

                    Kind regards,

                    Daniel Branco.

                    • 7. Re: JBoss 5 Avoid printing some exception thrown.
                      Wolf-Dieter Fink Master

                      I meant a simple class inherit from Exception which is in your case.

                      As I remember I use such behaviour for an EJB2 application. It might be that a EJB3 app is different.

                      I'll try to check the behaviour if I find a bit time

                       

                      BTW I hope you use JBoss 5.1, please specified exact.

                      • 8. Re: JBoss 5 Avoid printing some exception thrown.
                        daniel.branco Newbie

                        Hi Wolf,

                         

                        Yes we are using JBoss 5.1.

                         

                        Thanks for your help.

                         

                        Kind regards,

                        Daniel Branco.