将 hello1 web 模块部署到 glassfish 时出错,来自 java 个教程

Error while deploying hello1 web module to glassfish, from java tutorials

我正在关注 java ee 文档中的 this tutorial,并且正在尝试将一个简单的 Web 模块部署到 glasfish 服务器。

6.3.2.1 To Build and Package the hello1 Web Module Using NetBeans IDE

  1. Start GlassFish Server as described in To Start GlassFish Server Using NetBeans IDE, if you have not already done so.

  2. From the File menu, choose Open Project.

  3. In the Open Project dialog box, navigate to:
    tut-install/examples/web/jsf

  4. Select the hello1 folder.

  5. Click Open Project.

  6. In the Projects tab, right-click the hello1 project and select Build. This command deploys the project to the server.

当我点击 Build 时,它失败了并给了我以下错误

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 26.227s
Finished at: Thu Apr 05 11:38:32 IST 2018
Final Memory: 11M/80M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy (deploy) on project hello1: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [glassfish5x], type = [installed]], configuration type [existing]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

我下载了 javaEE 并按照教程中的说明进行了所有操作,为什么我会收到错误消息?

看起来您使用的是 Glassfish 5,在编写 EE7 教程时它还不存在。

尝试 downloading and installing the latest version of Glassfish 4(版本 4.1.2),并使用它代替 Glassfish 5。

在继续本教程之前,绝对值得验证您的 Glassfish 4 安装是否正常工作:

  • 启动 Glassfish 4 服务器并在浏览器中输入 http://localhost:4848
  • 您应该会看到如下所示的 Glassfish 4.x 管理控制台。
  • 点击左上角的关于按钮验证版本。

我在 pom.xml 更新了 cargo 版本 (glassfish5\docs\javaee-tutorial\examples\pom.xml): <cargo.plugin.version>1.8.4</cargo.plugin.version>