jbossas / jboss-as-maven-plugin

Maven plugin to deploy applications to JBoss AS 7 (moved to https://github.com/wildfly/wildfly-maven-plugin)
74 stars 69 forks source link

NPE in add-resource #4

Closed mareknovotny closed 12 years ago

mareknovotny commented 13 years ago

Hey Jamez,

I have got the following configuration in my pom.xml:

<plugin>
   <groupId>org.jboss.as.plugins</groupId>
   <artifactId>jboss-as-maven-plugin</artifactId>
   <version>7.0.1.Final</version>
   <executions>
        <execution>
            <id>add-datasource</id>
            <phase>package</phase>
            <configuration>
                <address>subsystem=datasources,data-source=java:/bookingDatasource</address>
                <properties>
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
                    <jndi-name>java:/bookingDatasource</jndi-name>
                    <enabled>true</enabled>
                    <pool-name>bookingDSPool</pool-name>
                    <user-name>sa</user-name>
                    <password></password>
                    <driver-name>h2</driver-name>
                </properties>
            </configuration>
            <goals>
                <goal>add-resource</goal>
            </goals>
        </execution>
         <execution>
            <phase>package</phase>
            <goals>
                <goal>deploy</goal>
            </goals>
        </execution>
    </executions>
</plugin>

When I run mvn clean package it ends with:

[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.0.1.Final:add-resource (add-datasource) on project booking-ear: Could not execute goal add-resource. Reason: null: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.0.1.Final:add-resource (add-datasource) on project booking-ear: Could not execute goal add-resource. Reason: null
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    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:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not execute goal add-resource. Reason: null
    at org.jboss.as.plugin.deployment.resource.AddResource.execute(AddResource.java:134)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.lang.NullPointerException
    at org.jboss.as.plugin.deployment.resource.AddResource.execute(AddResource.java:125)
    ... 21 more
jamezp commented 13 years ago

We will get this fixed, but just so you know there is a silly workaround. Well, kind of a workaround. If were to execute the command again it should work. It's the way we're trying to force the re-add that's causing the issue.

mareknovotny commented 13 years ago

Hmm, I guess that the workaround doesn't work for me. I did repeat the command many times. I also tried only mvn jboss-as:add-resource three times and the error is always showed up and with the same NPE.

mareknovotny commented 13 years ago

One thing as additional info, I am using also deploying of EAR application and it works fine, if I create datasource on CLI or manually in admin console.

mareknovotny commented 12 years ago

It seems that version 7.1.0.Beta1b works fine now.