开发者

Unable to catch COMM_FAILURE exception (java)

I´m communicating a standalone application with an EJB, if the server that holds the EJB is not turned on I receive a COMM_FAILURE like this one:

May 11, 2011 9:42:50 AM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431)
      ...
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at app.comercio.system.RemoteBeans.lookupProducts(RemoteBeans.java:33)
    at app.comercio.system.Controller.sendSpec(Controller.java:86)
    at app.comercio.view.Main.sendSpec(Main.java:175)
    at app.comercio.view.Main.main(Main.java:54)

I try to catch this exception on main, and I throw 开发者_高级运维it on sendSpec, sendSpec and lookupProducts, however I don't know if this es effective because InitialContext.lookup only throws NamingException. Is there a way to catch this exception?


well this is a runtime exception so it won't be declared to be thrown but you can still catch it and handle it like any exception

   extended byjava.lang.Throwable
      extended byjava.lang.Exception
         extended byjava.lang.RuntimeException
              extended byorg.omg.CORBA.SystemException
                  extended byorg.omg.CORBA.COMM_FAILURE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜