Maven GlassFish插件:asadmin CreateProcess error = 193

tha*_*guy 9 glassfish maven maven-glassfish-plugin

通常我会去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>
Run Code Online (Sandbox Code Playgroud)

我的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]
Run Code Online (Sandbox Code Playgroud)

Jan*_*Jan 30

这是所描述的Windows下的问题在这里.删除asadmin(不带扩展名)文件应该会有所帮助,直到修复为止.

  • 或者使用".sh"扩展名重命名该文件. (9认同)