Greetings,

I've been using Maven and Surefire on a project for about a year now and have 
sporadically seen a problem that I've always been able to get around but want 
to get to the bottom of.  It's a null pointer exception sometimes when I run 
"mvn" and it tries to run all our tests.  It happens rarely but four different 
people on the project have run into it at one point or another.  For some 
reason if I bypass the tests and start my Jetty server through maven, I can go 
back to run the tests after stopping Jetty and the tests run just fine.  This 
is typically my workaround.

Here is the output from the command line:

C:\workspaces\tesla\readiness-mobile\tesla-src-mobile>mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Templated Service Layer Assembler
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, 
i.e. build is platform dependent!
[INFO] Copying 6 resources
Downloading: http://repo1.maven.org/maven2/com/nike/classes/2.2/classes-2.2.pom
[INFO] Unable to find resource 'com.nike:classes:pom:2.2' in repository central 
(http://repo1.maven.org/maven2)
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to 
C:\workspaces\tesla\readiness-mobile\tesla-src-mobile\target\classes
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, 
i.e. build is platform dependent!
[INFO] Copying 76 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: 
C:\workspaces\tesla\readiness-mobile\tesla-src-mobile\target\surefire-reports
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:394)
        at java.util.Properties.setProperty(Properties.java:143)
        at 
org.apache.maven.surefire.booter.SurefireBooter.setForkProperties(SurefireBooter.java:510)
        at 
org.apache.maven.surefire.booter.SurefireBooter.forkSuites(SurefireBooter.java:483)
        at 
org.apache.maven.surefire.booter.SurefireBooter.runSuitesForkOnce(SurefireBooter.java:385)
        at 
org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:246)
        at 
org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:581)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at 
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Mon Nov 01 08:49:35 PDT 2010
[INFO] Final Memory: 19M/46M
[INFO] ------------------------------------------------------------------------
C:\workspaces\tesla\readiness-mobile\tesla-src-mobile>

And here is the Surefire configuration in the pom.xml:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <additionalClasspathElements>
            
<additionalClasspathElement>${resource-bundle-path}</additionalClasspathElement>
          </additionalClasspathElements>
        </configuration>
      </plugin>

I'm thinking this is probably a bug in Maven or Surefire but I can't find any 
mention of it on Google.  Has anyone run into this or know what causes it?

Thanks,
Cameron

Cameron Hinkle  |  Senior Application Engineer  |  Nike DCIT  |  503.532.3075  
|  7. Evolve Immediately |

Reply via email to