mavenglassfishmaven-glassfish-plugin

Maven GlassFish plugin: asadmin CreateProcess error=193


Normally I would just go to the java.net site and look up what the error code I am getting is about but their web site is currently offline. Basically I am following this guide:

http://pookey.co.uk/wordpress/archives/95-getting-started-with-glassfish-using-maven

to try and get an example maven web application deployed on my GlassFish application server. My POM file is as follows:

<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>

My GlassFish application server is up and running, but I get the following error message when I execute

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]

Solution

  • This is an issue under Windows as described here. Deleting the asadmin (without extension) file should help until it is fixed.