environment getInitialContext() stuck

Hi, i have some java code that try to get intiialcontext to a weblogic server. it works fine, until the weblogic server status became FAILED. Then the code would just stuck at that line, NOT going into exception or anything.  Cant figure out what is going on, can someone provide a few pointers, thanks.

Environment env = new Environment();
        env.setProviderUrl(_url);
        env.setSecurityPrincipal(_user);
        env.setSecurityCredentials(_password);
        try {
          //WHEN WEBLOGIC SERVER STATE BECAME FAILED, IT STUCKS AT THIS LINE
          //CONFIRMED BY STEP THRU VIA DEBUG
           ctx = env.getInitialContext(); <---STUCKS AT THIS LINE
           home = (MBeanHome) ctx.lookup(MBeanHome.LOCAL_JNDI_NAME);
        } catch (AuthenticationException e)
       {
      etc....
LVL 1
gagaliyaAsked:
Who is Participating?
 
mrcoffee365Connect With a Mentor Commented:
We have found that there are some states with Web servers where they will not disconnect.  I don't know if that is what you are seeing, but I believe the only foolproof solution is to put a timer on the request, and kill it if it goes too long.

If you use HttpClient to make your connection, then this documentation on doing a timeout might help:
http://www.innovation.ch/java/HTTPClient/advanced_info.html
0
 
gagaliyaAuthor Commented:
I want it to go into exceptions,so the program can continue executing.  To confirm again the program does not exit or throw any exceptions/error, it just stuck in run mode at this line.
0
 
gagaliyaAuthor Commented:
thanks
0
All Courses

From novice to tech pro — start learning today.