New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not instiate Spec #917

Open
rickle-msft opened this Issue Sep 20, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@rickle-msft

rickle-msft commented Sep 20, 2018

Issue description

Running mvn test on a clean vm or in travis yields:

org.spockframework.util.InternalSpockError: Failed to instantiate spec 'AppendBlobAPITest'
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
Caused by: java.lang.ExceptionInInitializerError
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
Caused by: java.lang.NullPointerException
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)

for the first spec attempted and:

org.spockframework.util.InternalSpockError: Failed to instantiate spec 'DownloadResponseTest'
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.microsoft.azure.storage.APISpec
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)

for all subsequent specifications. I can run the tests fine in IntelliJ and on the command line on my local machine, so I'm guessing there's some configuration cached somewhere, but so far I'm unable to determine what that would be. I can point you to our pom if that would be helpful as well.

Java/JDK

jdk1.8.0_181

Groovy version

2.4.13

Build tool version

Apache Maven

3.5.4

Operating System

Windows

Apache Maven

<dependency>
  <groupId>org.spockframework</groupId>
  <artifactId>spock-core</artifactId>
  <version>1.1-groovy-2.4</version>
</dependency>

Thank you for your help

@leonard84

This comment has been minimized.

Show comment
Hide comment
@leonard84

leonard84 Sep 21, 2018

Member

@rickle-msft you seem to be missing com.microsoft.azure.storage.APISpec without more information there is nothing we can do.

Member

leonard84 commented Sep 21, 2018

@rickle-msft you seem to be missing com.microsoft.azure.storage.APISpec without more information there is nothing we can do.

@rickle-msft

This comment has been minimized.

Show comment
Hide comment
@rickle-msft

rickle-msft Sep 21, 2018

Thank you for your response. The class is there, and the Groovy sources are being compiled correctly. I was able to determine that some environments weren't setting some environment variables, which was causing the NPE in initializing some fields on the type APISpec.

Even though I was able to determine this was our error, I think it would be a good idea to improve the error messages so that if an error like this NPE is hit in the initializing the spec, the line number of the error rather than the invoke method of the JunitRunner is displayed to the user.

rickle-msft commented Sep 21, 2018

Thank you for your response. The class is there, and the Groovy sources are being compiled correctly. I was able to determine that some environments weren't setting some environment variables, which was causing the NPE in initializing some fields on the type APISpec.

Even though I was able to determine this was our error, I think it would be a good idea to improve the error messages so that if an error like this NPE is hit in the initializing the spec, the line number of the error rather than the invoke method of the JunitRunner is displayed to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment