META-INF / application.xml中的文件过早结束

时间:2018-11-14 10:05:01

标签: java glassfish

我已经通过maven 3创建了一个Web应用程序,并且在项目结构中有myartifactid / META-INF / application.xml文件。其中包含:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_8.xsd"
             version="8">

</application>

我正在使用带有jdk 1.8.0_191的GlassFish 5。每当我启动服务器时,都会出现以下错误(文件的结尾过早。请参阅server.log以获取更多详细信息。位于application.xml中):

Successfully started the domain : domain1
domain  Location: /usr/applicationserver/glassfish5/glassfish/domains/domain1
Log File: /usr/applicationserver/glassfish5/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Connected to server
[2018-11-14 11:45:33,345] Artifact myproject: Artifact is being deployed, please wait...
[2018-11-14 11:45:35,767] Artifact myproject: Error during artifact deployment. See server log for details.
[2018-11-14 11:45:35,767] Artifact myproject: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while deploying the app [myproject] : org.xml.sax.SAXParseExceptionpublicId: http://www.oracle.com/technetwork/java/index.html; lineNumber: 1; columnNumber: 1; Deployment descriptor file META-INF/application.xml in archive [myproject].  Premature end of file.. Please see server.log for more details.

在Intellij中,它给我一个错误“必须声明元素应用程序”。环顾四周,似乎该文件用作javaeeApplication的部署描述符。在Intellij的myproject.iml文件中,我有:

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="FacetManager">
    <facet type="javaeeApplication" name="javaEEApplication">
      <configuration>
        <descriptors>
          <deploymentDescriptor name="application.xml" url="file://$MODULE_DIR$/META-INF/application.xml" />
        </descriptors>
      </configuration>
    </facet>
    <facet type="web" name="Web">
      <configuration>
        <descriptors>
          <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/web/WEB-INF/web.xml" />
        </descriptors>
        <webroots>
          <root url="file://$MODULE_DIR$/web" relative="/" />
        </webroots>
        <sourceRoots>
          <root url="file://$MODULE_DIR$/src/main/java" />
        </sourceRoots>
      </configuration>
    </facet>
  </component>
</module>

1 个答案:

答案 0 :(得分:0)

部署描述符中的URL错误。 java.sun.com的所有使用应为xmlns.jcp.org。如果您的部署描述符是由程序创建的,请将此错误报告给该程序的所有者。如果更正了此错误后,如果您的应用程序部署失败,请相应地更新您的帖子。