11 Replies Latest reply on Dec 4, 2009 12:43 PM by Nicklas Karlsson

    application exception wrapped in RuntimeException

    Michael Brackx Newbie

      When injecting an EJB in an EJB with @Inject, my application exceptions thrown by the injected EJB get wrapped in a RuntimeException. And that is changing my application behavior.
      This is on jboss as 6.0.0.M1.

        • 1. Re: application exception wrapped in RuntimeException
          Nicklas Karlsson Master

          PTFSTP (Post the Full Stack Trace, Please)

          • 2. Re: application exception wrapped in RuntimeException
            Michael Brackx Newbie

            ReadLocal is the inject EJB interface


            ReadBean is the implementation that throws an ApplicationSecurityException


            java.lang.RuntimeException: Error invoking method read on interface com.unifiedpost.alexandria.ejb.ReadLocal
                 at org.jboss.weld.util.Reflections.invokeAndWrap(Reflections.java:529)
                 at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:123)
                 at com.unifiedpost.alexandria.ejb.ReadLocal_$$_javassist_26.read(ReadLocal_$$_javassist_26.java)
                 at com.unifiedpost.alexandria.rest.resource.service.DocumentResourceBean.readInternal(DocumentResourceBean.java:195)
                 at com.unifiedpost.alexandria.rest.resource.service.DocumentResourceBean.readWithFilename(DocumentResourceBean.java:175)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 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.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138)
                 at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:147)
                 at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doAroundInvoke(Jsr299BindingsInterceptor.java:120)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83)
                 at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70)
                 at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:59)
                 at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)
                 at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 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_665483948.invoke(InvocationContextInterceptor_z_fillMethod_665483948.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_665483948.invoke(InvocationContextInterceptor_z_setup_665483948.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.invokeInOurTx(TxPolicy.java:79)
                 ... 58 more
            Caused by: java.lang.reflect.InvocationTargetException
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.jboss.weld.util.Reflections.invokeAndWrap(Reflections.java:517)
                 ... 104 more
            Caused by: com.unifiedpost.alexandria.security.ApplicationSecurityException
                 at com.unifiedpost.alexandria.ejb.ReadBean.objectizeContext(ReadBean.java:92)
                 at com.unifiedpost.alexandria.ejb.ReadBean.read(ReadBean.java:55)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 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.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138)
                 at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:147)
                 at org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor.doAroundInvoke(Jsr299BindingsInterceptor.java:120)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83)
                 at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70)
                 at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:59)
                 at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)
                 at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 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_665483948.invoke(InvocationContextInterceptor_z_fillMethod_665483948.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_665483948.invoke(InvocationContextInterceptor_z_setup_665483948.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.invokeInCallerTx(TxPolicy.java:126)
                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
                 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.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.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:180)
                 at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:238)
                 at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:188)
                 at $Proxy196.read(Unknown Source)
                 ... 109 more



            • 3. Re: application exception wrapped in RuntimeException
              Gavin King Master

              That;s a bug, please report it in JIRA. InvocationContext.proceed() should not use invokeAndWrap(), it should propagate exceptions.

              • 4. Re: application exception wrapped in RuntimeException
                Nicklas Karlsson Master

                Fixed in trunk. Well, if not fixed then at least committed. Testing is for end users ;-)

                • 8. Re: application exception wrapped in RuntimeException
                  Michael Brackx Newbie

                  Unfortunately, i did that before asking, but did not find it there.


                  Apparently the artifacts are in the sonatype repo, however also there there is no distribution.

                  • 10. Re: application exception wrapped in RuntimeException
                    Michael Brackx Newbie

                    It works now. Thanks Nicklas.


                    I tested jboss as M1 (released) + javax.inject.jar + weld-core.jar built from r 5211

                    • 11. Re: application exception wrapped in RuntimeException
                      Nicklas Karlsson Master

                      Ha! Now I don't have to write that unit test for it ;-)