使用 IntelliJ IDEA 部署 RESTful Web 服务应用程序失败
Failure deploying RESTful web service application using IntelliJ IDEA
我正在尝试在 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 方面,部署描述符似乎也已正确设置。我将 Jersey-2.2 引用为使用 RESTful 服务的库。我的项目也有 GlassFish 4.1.1 - RESTful Web 服务作为依赖项。
我正在使用从模块自动生成的 Exploded 工件,并且 运行 配置设置为构建然后构建工件。 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 是一个错误,因为它只是一个 restful Web 服务。现在我面临一个新问题,输出告诉我 Application [CapstoneIntelliJProject_war_exploded] contains no valid components.
。服务器日志不包含任何有用的信息。我不确定我的 war 有什么问题,它似乎配置得很好。
我已经通过重新创建 war
解决了 war 爆炸问题
我正在尝试在 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 方面,部署描述符似乎也已正确设置。我将 Jersey-2.2 引用为使用 RESTful 服务的库。我的项目也有 GlassFish 4.1.1 - RESTful Web 服务作为依赖项。
我正在使用从模块自动生成的 Exploded 工件,并且 运行 配置设置为构建然后构建工件。 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 是一个错误,因为它只是一个 restful Web 服务。现在我面临一个新问题,输出告诉我 Application [CapstoneIntelliJProject_war_exploded] contains no valid components.
。服务器日志不包含任何有用的信息。我不确定我的 war 有什么问题,它似乎配置得很好。
我已经通过重新创建 war
解决了 war 爆炸问题