如何消除我的GlassFish Java EE应用程序对Internet的依赖性? [英] How do I eliminate my GlassFish Java EE application's dependency on the Internet?

查看:82
本文介绍了如何消除我的GlassFish Java EE应用程序对Internet的依赖性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天上午我发现(2015-01-10),我无法在没有Internet连接的情况下在GlassFish 4.1中部署我的Java EE应用程序。当我尝试部署应用程序并收到以下错误时,我意识到了这一点:

   -  java.io.IOException:解析错误描述符存档中的部署描述符文件META-INF / glassfish-ejb-jar.xml [elis-ejb-0.0.1-SNAPSHOT_jar]。 
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:361)
at com.sun.enterprise.deployment.util.DOLUtils.readRuntimeDeploymentDescriptor(DOLUtils.java:512)
- ...
- 导致:java.io.IOException:服务器返回的HTTP响应代码:503:URL:http://www.oracle.com/splash/java.net/maintenance/ index.html
在sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838)
在sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java :1439)



显然,几个Oracle网站直到今天上午中央时间08:30左右我的GlassFish Java EE应用程序依赖于在应用程序部署期间解析glassfish-ejb-jar.xml文件。我注意到 http://www.glassfish.org 也导致出现以下错误信息页面,直到我能够再次部署我的应用程序。



>

我目前正在开发应用程序,所以我可以等待网站恢复,然后继续我的开发,但没有太多不便。但是,这个事件让我担心最终部署应用程序来运行我的公司,因为这些应用程序需要运行,并且最好在没有Internet连接的情况下部署。



我如何确定我的应用程序的互联网依赖关系?



如何消除我的应用程序的互联网依赖项?

以下是我的ejb -jar.xml。

 <?xml version =1.0encoding =UTF-8?> 
< ejb-jar xmlns =http://xmlns.jcp.org/xml/ns/javaee
xmlns:xsi =http://www.w3.org/2001/XMLSchema -instance
xsi:schemaLocation =http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2 .xsd
version =3.2>
< / ejb-jar>

以下是我的glassfish-ejb-jar.xml文件。

 <!DOCTYPE glassfish-ejb-jar PUBLIC -  // GlassFish.org// 
DTD GlassFish应用服务器3.1 EJB 3.1 // EN
http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd\">
< glassfish-ejb-jar>
< display-name> elis-ejb< / display-name>
< / glassfish-ejb-jar>


解决方案

我在java上发现了一篇类似hzhang_jn的文章。网上论坛,声明如下:


在声明DOCTYPE时,您的glassfish-web.xml中可能有错字.... DOCTYPE用于将声明的dtd解析到本地存储库
并验证。当DOCTYPE错误时,它会尝试去互联网
并获取dtd ...

我仔细比较我的glassfish-ejb-jar.xml文件的DOCTYPE与GlassFish 4.0应用程序部署指南中列出的DOCTYPE完全相同。实际上,我有信心通过从指南中剪切和粘贴来创建我的glassfish-ejb-jar.xml文件。无论如何,在将我的三行DOCTYPE更改为一行后,我能够部署我的应用程序而无需访问Internet。



不使用Internet连接的DOCTYPE: p>

 <!DOCTYPE glassfish-ejb-jar PUBLIC -  // GlassFish.org //DTD GlassFish Application Server 3.1 EJB 3.1 // ENhttp://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd\"> 

需要Internet连接的DOCTYPE:

<$ p
<!DOCTYPE glassfish-ejb-jar PUBLIC - // GlassFish.org//
DTD GlassFish Application Server 3.1 EJB 3.1 // EN
http: //glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd\">

谢谢@unwichtich的帮助!


I discovered this morning (2015-01-10) that I cannot deploy my Java EE application in GlassFish 4.1 without an Internet connection. I realized this fact when I tried to deploy my applications and received the following error:

- java.io.IOException: Error parsing descriptor Deployment descriptor file META-INF/glassfish-ejb-jar.xml in archive [elis-ejb-0.0.1-SNAPSHOT_jar].   
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:361)   
at com.sun.enterprise.deployment.util.DOLUtils.readRuntimeDeploymentDescriptor(DOLUtils.java:512) 
- ...
- Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.oracle.com/splash/java.net/maintenance/index.html   
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838)   
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)

Apparently, several Oracle web sites where down until around 08:30 central time this morning that my GlassFish Java EE application depends on to parse the glassfish-ejb-jar.xml file during application deployment. I noticed that http://www.glassfish.org also resulted in the following error message page until the same time that I was able to deploy my application again.

I am currently developing the application, so I was able to wait for the web site(s) to recover before continuing my development without much inconvenience. However, this incident worries me about the eventual deployment of the application to run my company because the applications needs to run and preferably to deploy without an Internet connection.

How do I identify my application's Internet dependencies?

How do I eliminate my application's Internet dependencies?

The following is my ejb-jar.xml.

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                             http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd"
         version="3.2">
</ejb-jar>

The following is my glassfish-ejb-jar.xml file.

<!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//
DTD GlassFish Application Server 3.1 EJB 3.1//EN"
"http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd">
<glassfish-ejb-jar>
    <display-name>elis-ejb</display-name>
</glassfish-ejb-jar>

解决方案

I found a similar post by hzhang_jn on a java.net forum that stated the following:

You might have a typo in your glassfish-web.xml when declaring the DOCTYPE....The DOCTYPE is used to resolve the declared dtd to the local repository and validate. When the DOCTYPE is wrong, it will try to go to internet and fetch the dtd...

I carefully compared the DOCTYPE of my glassfish-ejb-jar.xml file to the one listed in the GlassFish 4.0 Application Deployment Guide and they were exactly the same. In fact, I am confident that I created my glassfish-ejb-jar.xml file by cutting and pasting from the guide. Regardless, after I changed my three line DOCTYPE to one line, I was able to deploy my application without access to the Internet.

DOCTYPE that works without Internet Connection:

<!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd">

DOCTYPE that requires Internet connection:

<!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//
DTD GlassFish Application Server 3.1 EJB 3.1//EN"
"http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd">

Thank you @unwichtich for your help!

这篇关于如何消除我的GlassFish Java EE应用程序对Internet的依赖性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆