14 Replies Latest reply on Sep 8, 2008 2:12 AM by venu gopal

    HTTPConnection in startup servlet works only with hot deploy

    venu gopal Newbie


      * We are developing a J2EE application in which we have to download some XML when the WAR file(Say MyApp.WAR.) is deployed.

      * I have put the downloading XML logic to be called from a startup servlet. So far so good.

      * I have 5 customers for whom i would have to have 5 WAR files like MyApp1.WAR,MyApp2.WAR,MyApp3.WAR,MyApp4.WAR,MyApp5.WAR but all these WAR files have to download XMLs which are unique for each WAR.

      Real Problem comes when i restart JBoss. The deployer does not proceed further after the line in my code where i read the input stream, which results in the failure of all further deployments in the same server.

      u = new URL (url);
      httpConn = ( HttpURLConnection ) u.openConnection ( );
       httpConn.setRequestMethod ( "GET" ) ;
      Log.info(AppConstants.LOG_CATEGORY," before http connection");
      httpConn.connect () ;
      Log.info(AppConstants.LOG_CATEGORY,"after http connection");
      if(httpConn !=null)
       inputStream=httpConn.getInputStream(); // here is where it hangs
       }catch (Exception e) {
      Log.error(AppConstants.LOG_CATEGORY,"Exception fetching inputstream :"+e);

      * In the above code, it doesnt even throw an exception, just hangs .

      * to fix this, i have to remove all 5 WAR files out of deploy folder, start JBoss and then place all the WAR files back to the deploy folder. It works fine.
      * I don't understand why it works only with Hot deploy and not with a restart.
      * Please let me know if anything could be done on this (or) in case you need more info.