我正在尝试在IntelliJ IDEA上创建一个简单的RESTful Web服务,现在我遇到以下错误:
The content of element 'application' is not complete. One of '{"http://java.sun.com/xml/ns/javaee":description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":initialize-in-order, "http://java.sun.com/xml/ns/javaee":module}
我认为之前我的application.xml
内部不需要这些元素,然后突然在部署时遇到了这个问题。
我在项目中启用了javaEEApplication和Web facet,部署描述符似乎也正确设置。我将Jersey-2.2引用为使用RESTful服务的库。我的项目还有GlassFish 4.1.1 - 作为依赖项的RESTful Web服务。
我正在使用从模块自动生成的爆炸工件,并且运行配置设置为构建然后构建工件。 glassfish管理员的凭据是正确的。
我想知道为什么我突然遇到这个问题,我认为IntelliJ会在部署描述符(application.xml
)内自动生成所需的内容。有谁知道我错过了什么?也许我必须将Java EE 6或7作为库本身引用?我迷失了。
以下完整错误日志以防万一:
"C:\Program Files (x86)\glassfish4\glassfish\bin\asadmin.bat" start-domain domain1
"C:\Program Files\Java\jdk1.8.0_77\bin\java" -Dfile.encoding=windows-1252 -classpath "C:\Program Files (x86)\glassfish4\glassfish\modules\javax.ejb-api.jar;C:\Program Files.....
[2017-02-05 03:16:49,423] Artifact CapstoneIntelliJProject:war exploded: Server is not connected. Deploy is not available.
Detected server admin port: 4848
Detected server http port: 8080
Attempting to start domain1.... Please look at the server log for more details.....
Connected to server
[2017-02-05 03:16:52,358] Artifact CapstoneIntelliJProject:war exploded: Artifact is being deployed, please wait...
[2017-02-05 03:16:53,536] Artifact CapstoneIntelliJProject:war exploded: Error during artifact deployment. See server log for details.
[2017-02-05 03:16:53,537] Artifact CapstoneIntelliJProject:war exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while deploying the app [CapstoneIntelliJProject_war_exploded] : org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 15; Deployment descriptor file META-INF/application.xml in archive [CapstoneIntelliJProject_war_exploded]. cvc-complex-type.2.4.b: The content of element 'application' is not complete. One of '{"http://java.sun.com/xml/ns/javaee":description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":initialize-in-order, "http://java.sun.com/xml/ns/javaee":module}' is expected.. Please see server.log for more details.
"C:\Program Files (x86)\glassfish4\glassfish\bin\asadmin.bat" stop-domain domain1
Process finished with exit code 0
Waiting for the domain to stop .
Command stop-domain executed successfully.
Disconnected from server
编辑:我已经解决了这个特殊问题,为项目启用了javaEEapplication facet是一个错误,因为它只是一个宁静的Web服务。现在我遇到一个新问题,输出告诉我Application [CapstoneIntelliJProject_war_exploded] contains no valid components.
。服务器日志不包含任何有用的信息。我不确定我的战争有什么问题,似乎配置得很好。
答案 0 :(得分:0)
我通过重新创造战争解决了战争爆发的问题