简体   繁体   English

Java Web Start应用程序启动缓慢

[英]Slow Startup for Java Web Start Application

I'm using the Netbeans IDE to develop a Java Web Start application that will launch from the web and then use the EclipseLink JPA to access a remote MySQL database. 我正在使用Netbeans IDE开发一个Java Web Start应用程序,该应用程序将从Web启动,然后使用EclipseLink JPA访问远程MySQL数据库。 I'm using the Swing Application Framework to manage life cycle for my app. 我正在使用Swing应用程序框架来管理我的应用程序的生命周期。

When I launch the application from Netbeans it takes about 7 second for my application to load, but when I use the Netbeans IDE to create a Web Start distribution package (with the JAR and JNLP files) it takes about 60 seconds to launch. 当我从Netbeans启动应用程序时,我的应用程序加载大约需要7秒钟,但是当我使用Netbeans IDE创建Web Start分发包(包含JAR和JNLP文件)时,启动大约需要60秒。 Also, the "verifying application"/"downloading application" progressbar window seems to run every time I launch the app even though a copy of it has already been cached. 此外,每次启动应用程序时,“验证应用程序”/“下载应用程序”进度条窗口似乎都会运行,即使已经缓存了它的副本。

From the users point of view, one first sees my splash screen for 1 to 2 seconds, then the "verifying application"/"downloading application" progressbar window for 5 to 20 seconds and then nothing for a good 40 seconds before the application launches. 从用户的角度来看,首先看到我的启动画面1到2秒,然后“验证应用程序”/“下载应用程序”进度条窗口持续5到20秒,然后在应用程序启动前40秒内没有任何内容。

The app code is written such that it should show itself BEFORE the JPA starts loading the persistence unit (so I doubt that's the problem), but I thought I'd mention it just in case. 编写应用程序代码,以便它应该在JPA开始加载持久性单元之前显示自己(所以我怀疑这是问题),但我想我会提到它以防万一。


Update: Method createEntityManagerFactory Slow With Web Start 更新:方法createEntityManagerFactory使用Web Start缓慢

Having looked into this further, I've found that the method createEntityManagerFactory--which is necessary for EclipseLink to connect to MySQL--takes aboutn 5 seconds to execute when I run the applicaiton from Netbeans or when I remotely log in to my server to launch the JNLP there, but when I run the application via the web the same line takes 35 seconds (hugely delaying startup). 进一步研究后,我发现当我从Netbeans运行应用程序或者当我远程登录到我的服务器时,方法createEntityManagerFactory--这是EclipseLink连接到MySQL所必需的 - 大约需要5秒钟才能执行在那里启动JNLP,但是当我通过网络运行应用程序时,同一行需要35秒(大大延迟启动)。 Interestingly, this time gets even worse as my internet connection speed gets worse. 有趣的是,随着我的互联网连接速度变差,这一次变得更糟。 Below is a copy of the JNLP file I'm using. 下面是我正在使用的JNLP文件的副本。

Does anyone have any idea what may be causing such a delay? 有谁知道可能导致这种延迟的原因是什么?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

MyApp My App Vendor My App Description MyApp MyApp我的应用程序供应商我的应用程序描述MyApp

I'm not sure if you solved this yet. 我不确定你是否解决了这个问题。 But, I repeated your problem and fixed it. 但是,我重复了你的问题并修复了它。 All I had to do was switch from Eclipselink to Toplink. 我所要做的就是从Eclipselink切换到Toplink。 That simple. 那么简单。 Startups went from 1 to 2 minutes down to 5 seconds. 初创公司从1到2分钟缩短到5秒。 I even traced the app and found the same hanging during the init of eclipselink. 我甚至跟踪了应用程序,并在eclipselink初始化期间发现了同样的问题。

Hope it helps. 希望能帮助到你。

First of all, in the Java Control Panel enable ALL logging. 首先,在Java控制面板中启用所有日志记录。 This will allow you to see exactly what Java WebStart is doing (but much of it doesn't make much sense unless you have access to the WebStart source). 这将允许您准确了解Java WebStart正在做什么(但除非您有权访问WebStart源,否则其中大部分内容都没有意义)。

My guess from your description is that you have one or more unreachable DNS servers in your network configuration AND you want to access a network resource that isn't available. 我从您的描述中猜测 ,您的网络配置中有一个或多个无法访问的DNS服务器,并且您希望访问不可用的网络资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM