带货物和安装 Glassfish 的 Maven

Posted

技术标签:

【中文标题】带货物和安装 Glassfish 的 Maven【英文标题】:Maven with Cargo and Installed Glassfish 【发布时间】:2013-08-19 08:25:41 【问题描述】:

我的 maven 项目无法正常运行。我将在我的 pom 文件和错误日志下方显示。部署后,我正在尝试在 glassfish 上运行我的代码的集成测试。任何帮助都感激不尽。如果有更好的解决方案,那也将不胜感激。

pom.xml 货物部分:

<!-- cargo plugin -->
        <dependency>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-core-uberjar</artifactId>
            <version>1.4.3</version>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!-- cargo plugin -->
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.4.3</version>
                    <configuration>
                        <container>
                            <containerId>glassfish4x</containerId>
                            <type>installed</type>
                        </container>
                        <configuration>
                            <type>existing</type>
                            <home>C:\glassFishV4\glassfish4\glassfish\domains</home>
                            <properties>
                                <cargo.hostname>localhost</cargo.hostname>
                                <cargo.servlet.port>4848</cargo.servlet.port>
                                <!-- if no username/password don't use these, it will fail -->
                                <cargo.remote.username>admin</cargo.remote.username> 
                                <cargo.remote.passwordFile>C:\glassfish\glassfish4\glassfish\domains\domain1\config\admin-keyfile</cargo.remote.passwordFile>
                                <cargo.glassfish.domain.name>domain1</cargo.glassfish.domain.name>
                            </properties>
                        </configuration>
                        <deployables>
                            <deployable>
                                <groupId>com.project</groupId>
                                <artifactId>projectID</artifactId>
                                <location>$project.build.directory/$project.build.finalName.war</location>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </configuration>
                </plugin>

错误日志:

C:\Users\kev\projectID\com.project.projectID-1.0>mvn -e cargo:start
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building projectID 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- cargo-maven2-plugin:1.4.3:start (default-cli) @ projectID ---
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:car
go-core-container-glassfish:jar:1.4.3 for container glassfish4x
[INFO] [talledLocalContainer] GlassFish 4.x starting...
[INFO] [talledLocalContainer] Attempting to start domain1.... Please look at the
 server log for more details.....
[INFO] [talledLocalContainer] Authentication failed for user: admin
[INFO] [talledLocalContainer] with password from password file: C:/glassFishV4/g
lassfish4/glassfish/domains/password.properties
[INFO] [talledLocalContainer] (Usually, this means invalid user name and/or pass
word)
[INFO] [talledLocalContainer] Command deploy failed.
[INFO] [talledLocalContainer] GlassFish 4.x is stopping...
[INFO] [talledLocalContainer] Waiting for the domain to stop .
[INFO] [talledLocalContainer] Command stop-domain executed successfully.
[INFO] [talledLocalContainer] GlassFish 4.x is stopped
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.139s
[INFO] Finished at: Fri Aug 16 16:19:33 EDT 2013
[INFO] Final Memory: 12M/304M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.3:star
t (default-cli) on project projectID: Execution default-cli of goal org.codehaus.c
argo:cargo-maven2-plugin:1.4.3:start failed: Failed to start the GlassFish 4.x c
ontainer. At least one GlassFish deployment has failed: org.codehaus.cargo.util.
CargoException: GlassFish admin command failed: asadmin exited 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.codehaus.cargo:cargo-maven2-plugin:1.4.3:start (default-cli) on project projectID
: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.3:s
tart failed: Failed to start the GlassFish 4.x container.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:224)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:414)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
357)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-c
li of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.3:start failed: Failed to
start the GlassFish 4.x container.
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:115)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:208)
        ... 19 more
Caused by: org.codehaus.cargo.container.ContainerException: Failed to start the
GlassFish 4.x container.
        at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(Abstrac
tLocalContainer.java:230)
        at org.codehaus.cargo.maven2.ContainerStartMojo.executeLocalContainerAct
ion(ContainerStartMojo.java:96)
        at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStart
Mojo.java:63)
        at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo
.java:432)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:106)
        ... 20 more
Caused by: org.codehaus.cargo.util.CargoException: At least one GlassFish deploy
ment has failed: org.codehaus.cargo.util.CargoException: GlassFish admin command
 failed: asadmin exited 1
        at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
alledLocalContainer.doStart(AbstractGlassFishInstalledLocalContainer.java:193)
        at org.codehaus.cargo.container.spi.AbstractInstalledLocalContainer.star
tInternal(AbstractInstalledLocalContainer.java:313)
        at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(Abstrac
tLocalContainer.java:211)
        ... 24 more
Caused by: org.codehaus.cargo.util.CargoException: GlassFish admin command faile
d: asadmin exited 1
        at org.codehaus.cargo.container.glassfish.internal.GlassFish3xAsAdmin.in
vokeAsAdmin(GlassFish3xAsAdmin.java:88)
        at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
alledLocalContainer.invokeAsAdmin(AbstractGlassFishInstalledLocalContainer.java:
96)
        at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
alledLocalContainer.invokeAsAdmin(AbstractGlassFishInstalledLocalContainer.java:
69)
        at org.codehaus.cargo.container.glassfish.GlassFish3xInstalledLocalDeplo
yer.doDeploy(GlassFish3xInstalledLocalDeployer.java:89)
        at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
alledLocalDeployer.redeploy(AbstractGlassFishInstalledLocalDeployer.java:97)
        at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInst
alledLocalContainer.doStart(AbstractGlassFishInstalledLocalContainer.java:174)
        ... 26 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException

奇怪的是,我可以看到它通过 eclipse 启动 glassfish 服务器然后停止它。我还尝试不使用默认密码和用户名,因为它们就是这样,正如您在此配置中看到的那样,我使用货物站点上描述的用户名和密码文件。我两次收到相同的错误。

【问题讨论】:

您能否附上 Glassfish 服务器日志,因为这似乎是关于部署的 asadmin 投诉(来自堆栈跟踪)? 【参考方案1】:

拿起你的编辑器,打开C:/glassFishV4/g lassfish4/glassfish/domains/password.properties

变化:

AS_ADMIN_PASSWORD=adminadmin

收件人:

AS_ADMIN_PASSWORD=

【讨论】:

以上是关于带货物和安装 Glassfish 的 Maven的主要内容,如果未能解决你的问题,请参考以下文章

Glassfish ssl安装与certbot

安装maven和glassfish及配置环境变

arduino驱动带拨片的ST90S微型舵机完成货物拨取任务

CentOS安装JDK和安装Glassfish

Maven+glassfish基础搭建与使用

如何在不安装GlassFish的情况下下载最新的Java EE jar?