5

好吧,我试图遵循第一个杯子教程,但我遇到了 Glassfish 错误。

我应该这样做:

1.2.4 获取教程的最新更新

使用 Java EE 7 SDK 中包含的更新中心检查本教程的任何更新。

1.2.4.1 通过更新中心更新教程 打开更新中心并检查教程的任何更新。

在 NetBeans IDE 中,选择“服务”选项卡并展开“服务器”节点。右键单击 GlassFish Server 实例并选择查看更新中心以显示更新工具。在树中,选择可用更新以显示更新包的列表。查找 First Cup for Java EE 7 (javaee-firstcup-tutorial) 包的更新。如果有 First Cup 的更新版本,请选择 First Cup 7.0 for Java EE 7 (javaee-firstcup-tutorial) 并单击安装。

问题是,当我尝试打开更新中心时,我得到的是:

The software needed for this command (updatetool) is not installed.

If you choose to install Update Tool, your system will be automatically
configured to periodically check for software updates. If you would like
to configure the tool to not check for updates, you can override the
default behavior via the tool's Preferences facility.
Exception in thread "main" java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:196)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:658)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    at com.sun.pkg.client.Image.checkRepositoryConnection(Image.java:1225)
    at com.sun.pkg.client.Catalog.refresh(Catalog.java:132)
    at com.sun.pkg.client.Image.refreshCatalogs(Image.java:1627)
    at com.sun.pkg.client.Client.main(Client.java:109)

When this tool interacts with package repositories, some system information
such as your system's IP address and operating system type and version
is sent to the repository server. For more information please see:

http://wikis.oracle.com/display/updatecenter/UsageMetricsUC2

Once installation is complete you may re-run this command.

Would you like to install Update Tool now (y/n): 

C:\Program Files\glassfish-4.0>"C:\Program Files\Java\jdk1.7.0_40\bin\java" -Dimage.path="C:\Program Files\glassfish-4.0\bin\\.." -jar "C:\Program Files\glassfish-4.0\bin\\..\pkg/lib/pkg-client.jar" refresh 

C:\Program Files\glassfish-4.0>"C:\Program Files\Java\jdk1.7.0_40\bin\java" -Dimage.path="C:\Program Files\glassfish-4.0\bin\\.." -jar "C:\Program Files\glassfish-4.0\bin\\..\pkg/lib/pkg-bootstrap.jar" "C:\Users\Fabio\AppData\Local\Temp\pkg-bootstrap11073.props" 
Proxy: Using system proxy settings.
Input/output error: Connection reset

Could not download application packages. This could be because:
  - a proxy server is needed to access the internet. Please ensure that
    the system proxy server settings in your Internet Options control panel
    (under Connections:LAN Settings) are correct, or set the HTTP_PROXY
    environment variable to the full URL of the proxy server.
  - the package server or network connection is slow.
    If you are getting time out errors you can try setting the
    PKG_CLIENT_CONNECT_TIMEOUT and PKG_CLIENT_READ_TIMEOUT
    environment variables and try again. For example to increase
    the timeouts to 300 seconds set them to 300
  - the package server is down or otherwise inaccessible or it is
    generating invalid data. Please contact the provider of the package
    server.
4

5 回答 5

5

这可能是缓慢的 GlassFish 更新服务器的问题。以下是您可以尝试的一些步骤:

您应该先重试,看看错误是否再次发生。您可以启动一个 cmd,导航到\glassfish\bin目录并运行updatetool.bat,这样您就可以看到在您发布的输出之后打印的输出。

如果您使用代理,则应确保在系统设置中正确设置它。

您还可以尝试通过 GlassFish 管理控制台安装更新。启动 GlassFish 实例并导航到http:\\localhost:4848. 在左侧菜单的底部单击Updatetool。您可以在那里选择并安装所需的更新。

另一种选择是更改pkg工具的超时时间。要将超时设置为 300 秒,请在 cmd 中执行以下操作(在 Windows 上):

set PKG_CLIENT_CONNECT_TIMEOUT=300
set PKG_CLIENT_READ_TIMEOUT=300

您的最后一个(好的,可能还有其他)选项是跳过更新过程并使用当前版本进行教程。无论如何它应该可以工作,我可以在我的 GlassFish 更新中心看到目前只有教程文档的更新。

于 2013-10-21T19:24:17.680 回答
0

只需将此行设置为 cmd (如管理员):

set PKG_CLIENT_CONNECT_TIMEOUT=300
set PKG_CLIENT_READ_TIMEOUT=300
于 2013-12-12T16:09:37.227 回答
0

可能 firstcup 示例已经存在于安装目录中。尝试在 directory_install_glassfish/glassfish4/docs 中找到它。该矿甚至包含 javaee-tutorial 和 firstcup。对于下一部分,您可能会在 firstcup.pdf 中的指南之后继续以下部分:通过创建 java 项目的原型创建您的第一个 Java。祝你好运 !

于 2014-01-09T13:11:53.010 回答
0

对于懒惰的你们,pkg Unix命令是:

export PKG_CLIENT_CONNECT_TIMEOUT=300

export PKG_CLIENT_READ_TIMEOUT=300 
于 2015-02-18T18:31:33.950 回答
0

在从 Netbeans 安装 GlassFish 更新服务器(在我的公司网络中,代理问题)被卡住了一段时间后,我是这样理解的: - 高级系统设置 > 系统属性窗口 > 高级选项卡,新系统变量:http_proxy,http ://username:password@your_proxy:your_port - Netbeans(以管理员身份运行以防万一), Services > Server > Glassfish Server > Right button View Domain Update Center,然后安装

它对我有用,希望它有帮助!

于 2017-03-16T10:42:52.730 回答