开发者

connection timeouts in glassfish when trying to get sun-web-app_2_5

开发者 https://www.devze.com 2023-03-07 00:37 出处:网络
We have a problem when trying to deploy war files on a 开发者_JS百科glassfish v2 app server with liferay portal. when we upgraded from ubuntu 10.4 to 10.10 ( and greater) our deploy times went from 21

We have a problem when trying to deploy war files on a 开发者_JS百科glassfish v2 app server with liferay portal. when we upgraded from ubuntu 10.4 to 10.10 ( and greater) our deploy times went from 21 sec or so to 6 minutes. I seems like the problem is that a time-out occurs when trying to get http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd from oracle. Some thing must have changed in ubuntu between these releases. I guess a part of the problem is that we are behind a corporate firewall/proxy but that will not change Im afraid..

So what would be "best" to to. set the sun.net.client.defaultConnectTimeout to 21 sec (works and gives the same deploy times as in 10.4), store the dtd locally for access ( as now we don’t have access to it from neither 10.4 or 10.10 hence the time-out ). I guess we could alter the tcp settings for linux on our developer machines but that doesn’t seem like a good solution at all.

Using the following code we get a time-out of approx 21 sec on 10.4 and 189 sec on 10.10.

    long start = System.currentTimeMillis();
    try {     
        System.out.println("start");

        URL u = new URL("http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd");
        URLConnection conn;

        conn = u.openConnection();
        System.out.print(conn.getConnectTimeout());
        //conn.setConnectTimeout(5*1000);

        int readTimeout = conn.getReadTimeout();
        BufferedReader in = new BufferedReader(
                new InputStreamReader(
                conn.getInputStream()));
        String inputLine;

        while ((inputLine = in.readLine()) != null) {
            System.out.println(inputLine);
        }
        in.close();                        
    } catch (Exception ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println("Total time = " + (System.currentTimeMillis() - start) / 1000.0 + " seconds");


I would recommend that you use the admin console to tune the JVM settings to include the appropriate properties that define the JVM's proxied environment.

Here is a screenshot of the page in the console that you will need to use...

connection timeouts in glassfish when trying to get sun-web-app_2_5

This will allow the server to get to the missing dtd file without having to disturb the overall system configuration of your developer machines.

0

精彩评论

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