JavaEE 8教程,在hello1项目上部署失败

时间:2017-10-09 14:36:31

标签: java java-ee glassfish netbeans-8

我尝试学习Java EE 8,我已经按照https://javaee.github.io/tutorial/的官方指南进行了操作,但我遇到了这个问题:

--- cargo-maven2-plugin:1.4.4:redeploy (deploy) @ hello1 ---
[DeployerRedeployMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.4.4 for container glassfish5x
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.730s
Finished at: Mon Oct 09 16:16:40 CEST 2017
Final Memory: 18M/183M
------------------------------------------------------------------------
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

我完全按照指南进行操作,所以我不明白错误在哪里......

编辑: glassfish 5和4.1.1的错误相同。 如果我手动部署战争包它的工作;所以问题是maven和glassfish服务器之间的通信......

编辑2: 我找到了这个https://netbeans.org/bugzilla/show_bug.cgi?id=247746,但它没有工作......

6 个答案:

答案 0 :(得分:6)

I had the same problems, but managed to solved it this way:

In the parent pom located in ../glassfish5/docs/javaee-tutorial/examples directory I change the following properties to

<cargo.plugin.version>1.6.4</cargo.plugin.version>
<glassfish.domain.name>domain1</glassfish.domain.name>       
<glassfish.home>/Users/fgjensen/Java/J2EE8/glassfish5</glassfish.home>
<integration.container.id>glassfish4x</integration.container.id> 

This forces Maven to use the latest version of the cargo plugin. The plugin does not support Glassfish 5 as integration container currently. However, it builds and installs the applications anyway.

After this I also had to set the asadmin password in the password.properties file located in the /glassfish5/glassfish/domains directory.

I hope this solves your problems.

答案 1 :(得分:1)

Flemming G. Jensen说:

  

我遇到了同样的问题,但设法以这种方式解决了问题:

     

在位于../glassfish5/docs/javaee-tutorial/examples目录的父pom中,我将以下属性更改为

   <cargo.plugin.version>1.6.4</cargo.plugin.version>
   <glassfish.domain.name>domain1</glassfish.domain.name>       
   <glassfish.home>/Users/fgjensen/Java/J2EE8/glassfish5</glassfish.home>
   <integration.container.id>glassfish4x</integration.container.id>
     

这迫使Maven使用最新版本的货物插件。该插件目前不支持Glassfish 5作为集成容器。但是,它无论如何都会构建和安装应用程序。

     

在此之后,我还必须在/ glassfish5 / glassfish / domains目录中的password.properties文件中设置asadmin密码。

     

我希望这能解决你的问题。

你也可以在你的家庭目录中创建一个符号链接到GlassFish和JDK,而不是修改行

<glassfish.home>/Users/fgjensen/Java/J2EE8/glassfish5</glassfish.home>

答案 2 :(得分:0)

我按照以下步骤解决了这个问题:

  1. 启动Glassfish服务器
  2. 启动JavaDB
  3. 将路径环境设置为Glassfish和Marven
  4. 以这种方式在pom.xml上编辑glassfish home属性:

            <properties>
            <glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>
            </properties>
    
  5. 您应该在shell上运行“mvn install -X”来验证发生了什么

答案 3 :(得分:0)

尝试仅编辑父pom(在我的情况下为C:\ Program Files \ Java \ glassfish4 \ docs \ javaee-tutorial \ pom.xml)并更改此行

<glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>

获得绝对路线。

就我而言:

<glassfish.home>C:\Program Files\Java\glassfish4</glassfish.home>

对我有用。祝你好运。

答案 4 :(得分:0)

确保glassfish服务器已在部署之前启动(命令$ mvn install) 请注意,glassfish v4需要JDK6或JDK7。而glassfish v5需要JDK7或JDK8,而不是其他。 分享

答案 5 :(得分:0)

这在具有NetBeans 11.3的Windows 10上对我有效

<cargo.plugin.version>1.4.4</cargo.plugin.version>
<glassfish.domain.name>domain1</glassfish.domain.name>
<glassfish.home>C:\Javatools\glassfish5</glassfish.home>
<integration.container.id>glassfish4x</integration.container.id>

在C:\ Javatools \ glassfish5 \ docs \ javaee-tutorial \ examples \ pom.xml的第43-46行中,将java_ee_sdk-8u1.zip提取到C:\ Javatools。

引发错误的原始代码:

<cargo.plugin.version>1.4.4</cargo.plugin.version>
<glassfish.domain.name>domain1</glassfish.domain.name>
<glassfish.home>${glassfish.home.prefix}/glassfish5</glassfish.home>
<integration.container.id>glassfish5x</integration.container.id>

我需要为glassfish.home值使用绝对路径,以使其正常工作。

相关问题