0 Replies Latest reply on Aug 2, 2004 4:31 AM by gfzhang

    InitialContext.lookup never throws exception

    gfzhang

      This is a J2EE client using log4j to log information.

      To make the client robust, I decide to test the boundary condition. I stop the JBoss Server, then run the client. no exception is thrown, only warn message is printed on the console.

      To know why, I write a simple client as the following:


      public static void main( String[] argv)
       {
       try
       {
       System.out.println( "1") ;
       Context initial = null ;
       initial = new InitialContext() ;
       System.out.println( "2") ;
       Object objref = initial.lookup( "java:comp/env/" + UTILITY_FACADE) ;
       System.out.println( "3") ;
       UtilityFacadeHome home = ( UtilityFacadeHome ) PortableRemoteObject.narrow( objref, UtilityFacadeHome.class ) ;
       System.out.println( "4") ;
       UtilityFacade facade = home.create() ;
       System.out.println( "5") ;
       }
       catch ( Throwable ex )
       {
       System.out.println( "--Error--") ;
       throw new UtilityConnectionException( ex.getMessage() ) ;
       }
       System.out.println( "Done") ;
       }


      The output is:
      1
      2
      2004-08-02 16:26:48,078 WARN org.jnp.interfaces.NamingContext - Failed to connect to localhost:1099
      ......
      ... 10 more
      3
      4
      5
      Done

      What's wrong with the above code? May I miss some configuration?

      JBoss 3.2.5, JDK 1.4.2.

      Thank you very much.