4 Replies Latest reply on Mar 15, 2013 4:11 AM by Terry Ma

    jboss stops working after an exception thrown from an interceptor

    Terry Ma Newbie

          Hi, i encountered a problem about exception thrown from interceptor. i have a remote interface used by client side, an eao , and an interceptor used to catch any exception thrown from the eao.

      the interceptor code is

      @AroundInvoke

          public Object invoke(InvocationContext ic) throws Exception {

              try {

                  return ic.proceed();

              } catch (Throwable e) {

                  String methodName = ic.getMethod().getName();

                  Object[] para = ic.getParameters();

                  StringBuilder sb = new StringBuilder("invocation on method ");

                  sb.append(methodName).append(" failed. ");

                  if (para != null && para.length > 0) {

                      sb.append(" parameter(s) are (");

                      for (int i = 0; i < para.length; i++) {

                          sb.append(para[i].toString()).append(", ");

                      }

                      sb.append(")");

                  }

                  logger.error(sb.toString(), e);

                  throw new SFServiceException(sb.toString(), e);

              }

          }

      if i set the cause exception to SFServiceException, after the first call to eao, jboss will stop working, and the client code will get an exception

      javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Operation failed with status WAITING]

                at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)

                at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)

                at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)

                at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)

                at javax.naming.InitialContext.init(InitialContext.java:242)

                at javax.naming.InitialContext.<init>(InitialContext.java:216)

                at RemoteTest.before(RemoteTest.java:45)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

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

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

                at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)

                at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)

                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)

                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)

                at org.testng.TestRunner.beforeRun(TestRunner.java:641)

                at org.testng.TestRunner.run(TestRunner.java:609)

                at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

                at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

                at org.testng.SuiteRunner.run(SuiteRunner.java:240)

                at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

                at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

                at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)

                at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)

                at org.testng.TestNG.run(TestNG.java:1036)

                at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)

                at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)

                at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

      Caused by: java.lang.RuntimeException: Operation failed with status WAITING

                at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89)

                at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:56)

                at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:166)

                at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:139)

                at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)

                ... 27 more

       

      if i do not set the exception cause  to  SFServiceException like this throw new SFServiceException(sb.toString()); the jboss works fine. what is wrong with my code?