我已经从Java Tutorials下载了Java EE SDK。根据教程,我们必须将此SDK与netbeans集成,但Netbeans 7无法找到我的GlassFish服务器。因此,我在与教程中指定的相同位置安装了Netbeans和Glassfish,即C:\ glassfish4。然后,我将SDK中的docs文件夹复制到此安装并尝试构建,但它失败了
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ helloservice-war ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ helloservice-war ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.3:war (default-war) @ helloservice-war ---
[INFO] Packaging webapp
[INFO] Assembling webapp [helloservice-war] in [C:\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\target\hellos
ervice-war]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\src\main\webapp]
[INFO] Webapp assembled in [42 msecs]
[INFO] Building war: C:\glassfish4\docs\javaee-tutorial\examples\jaxws\helloservice-war\target\helloservice-war.war
[INFO]
[INFO] --- cargo-maven2-plugin:1.4.4:redeploy (deploy) @ helloservice-war ---
[INFO] [DeployerRedeployMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.4.4 for contai
ner glassfish4x
[INFO] [talledLocalContainer] Authentication failed for user: admin
[INFO] [talledLocalContainer] Command deploy failed.
[INFO] [talledLocalContainer] with password from password file: C:/glassfish4/glassfish/domains/password.properties
[INFO] [talledLocalContainer] (Usually, this means invalid user name and/or password)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] jaxws ............................................. SUCCESS [ 0.470 s]
[INFO] helloservice-war .................................. FAILURE [ 3.219 s]
[INFO] hello-appclient ................................... SKIPPED
[INFO] hello-webclient ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.257 s
[INFO] Finished at: 2015-07-19T14:51:43+05:30
[INFO] Final Memory: 26M/226M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy (deploy) on project helloservice-war: Execu
tion deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed: GlassFish admin command failed: asadmin exited
1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:rede
ploy (deploy) on project helloservice-war: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed
: GlassFish admin command failed: asadmin exited 1
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.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed: GlassFish admin command failed: asadmin exited 1
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.codehaus.cargo.util.CargoException: GlassFish admin command failed: asadmin exited 1
at org.codehaus.cargo.container.glassfish.internal.GlassFish3xAsAdmin.invokeAsAdmin(GlassFish3xAsAdmin.java:88)
at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInstalledLocalContainer.invokeAsAdmin(AbstractGlassFishInstalledLocalContainer.java:96)
at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInstalledLocalContainer.invokeAsAdmin(AbstractGlassFishInstalledLocalContainer.java:69)
at org.codehaus.cargo.container.glassfish.GlassFish3xInstalledLocalDeployer.doDeploy(GlassFish3xInstalledLocalDeployer.java:89)
at org.codehaus.cargo.container.glassfish.internal.AbstractGlassFishInstalledLocalDeployer.redeploy(AbstractGlassFishInstalledLocalDeployer.java:97)
at org.codehaus.cargo.maven2.DeployerRedeployMojo.performDeployerActionOnSingleDeployable(DeployerRedeployMojo.java:50)
at org.codehaus.cargo.maven2.AbstractDeployerMojo.performDeployerActionOnAllDeployables(AbstractDeployerMojo.java:166)
at org.codehaus.cargo.maven2.AbstractDeployerMojo.doExecute(AbstractDeployerMojo.java:97)
at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:432)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
... 20 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
答案 0 :(得分:4)
问题解决了。 Netbeans 7与Oracle SDK附带的Glassfish服务器有问题。所以,我没有将它添加到Netbeans并从命令行手动启动服务器和数据库并再次构建项目。
asadmin start-domain --verbose
asadmin start-database
在此之后,Projects正在建设中。