通常我会去java.net网站查看我得到的错误代码是什么,但他们的网站目前处于脱机状态。基本上我遵循这个指南:
http://pookey.co.uk/wordpress/archives/95-getting-started-with-glassfish-using-maven
尝试获取部署在GlassFish应用程序服务器上的示例maven Web应用程序。我的POM文件如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.cellnet.test</groupId>
<artifactId>hello-world</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>hello-world Maven Webapp</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>maven.java.net</id>
<name>Java.net Maven2 Repository</name>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>hello-world</finalName>
<plugins>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<user>admin</user>
<adminPassword>password</adminPassword>
<glassfishDirectory>C:\glassfish3</glassfishDirectory>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
<domain>
<name>domain1</name>
<adminPort>4848</adminPort>
<httpPort>8080</httpPort>
<httpsPort>8443</httpsPort>
</domain>
</configuration>
</plugin>
</plugins>
</build>
</project>
我的GlassFish应用程序服务器已启动并正在运行,但在执行
时出现以下错误消息mvn war:war glassfish:deploy
Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:
deploy (default-cli) on project hello-world: Deployment of myPathToMavenProject.war
has failed. IOException: Cannot run program "myPathToGlassfishFolder\bin\asadmin":
CreateProcess error=193, %1 is not a valid Win32 application -> [Help 1]
答案 0 :(得分:29)
这是Windows下的一个问题,如here所述。删除asadmin(不带扩展名)文件应该会有所帮助,直到它被修复。
答案 1 :(得分:1)
使用Glassfish4我遇到此错误并重命名\删除文件是不够的。我找到了this article,并且需要从as-install-parent/bin
和as-install/bin
中删除asadmin