尝试获取 sun-web-app_2_5 时 glassfish 中的连接超时
当尝试使用 liferay 门户在 glassfish v2 应用程序服务器上部署 war 文件时,我们遇到了问题。当我们从 ubuntu 10.4 升级到 10.10(及更高版本)时,我们的部署时间从 21 秒左右缩短到 6 分钟。我似乎问题是尝试获取 http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd 来自 Oracle。在这些版本之间,ubuntu 中肯定发生了一些变化。我想问题的一部分是我们位于公司防火墙/代理后面,但这不会改变我担心......
所以什么是“最好”的。将 sun.net.client.defaultConnectTimeout 设置为 21 秒(有效并提供与 10.4 中相同的部署时间),将 dtd 存储在本地以供访问(因为现在我们无法从 10.4 或 10.10 访问它,因此时间-出去 )。我想我们可以在开发者机器上更改 linux 的 tcp 设置,但这似乎根本不是一个好的解决方案。
使用以下代码,我们在 10.4 上得到约 21 秒的超时,在 10.10 上得到约 189 秒的超时。
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");
We have a problem when trying to deploy war files on a 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");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您使用 管理控制台将 JVM 设置 调整为 包含定义 JVM 代理环境的适当属性。
这是您需要使用的控制台页面的屏幕截图...
这将允许服务器获取丢失的 dtd 文件,而不必干扰开发人员计算机的整体系统配置。
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...
This will allow the server to get to the missing dtd file without having to disturb the overall system configuration of your developer machines.