Skip to content
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

swagger-codegen-cli doesn't build anymore with OpenJDK #1160

Closed
ePaul opened this issue Aug 31, 2015 · 8 comments · Fixed by #1161
Closed

swagger-codegen-cli doesn't build anymore with OpenJDK #1160

ePaul opened this issue Aug 31, 2015 · 8 comments · Fixed by #1161

Comments

@ePaul
Copy link
Contributor

ePaul commented Aug 31, 2015

Summary
The swagger-codegen project (and there specifically the swagger-codegen-cli subproject) doesn't build anymore on OpenJDK 1.7.0_79 (64 bit Server VM on Linux) in the current master (commit 2b48ec0).

Reproducible
Install the mentioned JVM, run mvn clean install in the project root.

You see several exceptions of this type:


testVerbose_ShortArg(io.swagger.codegen.cmd.GenerateTest)  Time elapsed: 0.001 sec  <<< FAILURE!
java.lang.IllegalStateException: To run on OpenJDK 64-Bit Server VM use -javaagent:/home/paulo/.m2/repository/org/jmockit/jmockit/1.18/jmockit-1.18.jar
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:205)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:108)
        at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

... and then

Tests run: 84, Failures: 19, Errors: 0, Skipped: 1

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] swagger-codegen-project ........................... SUCCESS [2.082s]
[INFO] swagger-codegen (core library) .................... SUCCESS [58.655s]
[INFO] swagger-codegen (executable) ...................... FAILURE [2.188s]
[INFO] swagger-codegen (maven-plugin) .................... SKIPPED
[INFO] swagger-generator ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:03.443s
[INFO] Finished at: Mon Aug 31 10:53:52 CEST 2015
[INFO] Final Memory: 38M/427M
[INFO] ------------------------------------------------------------------------

Analysis
Bisecting the problem shows commit e5811eb as the one which introduced the problem (its parent commit 392e517 builds without problems).

It looks like my VM doesn't work with the JMockit library (or the other way around), or it needs some special way to be used:

java.lang.IllegalStateException: To run on OpenJDK 64-Bit Server VM use -javaagent:/home/paulo/.m2/repository/org/jmockit/jmockit/1.18/jmockit-1.18.jar

By the way, JMockit seems to need JDK 1.8, while this project's README says to use JDK 1.7?

@ePaul
Copy link
Contributor Author

ePaul commented Aug 31, 2015

If I add

                        <argLine>-javaagent:/home/paulo/.m2/repository/org/jmockit/jmockit/1.18/jmockit-1.18.jar</argLine>

to the configuration of the maven-surefire-plugin, those 19 test errors disappear, I get three others instead:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: TestNG652Configurator
Configuring TestNG with: TestNG652Configurator
Tests run: 22, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 1.055 sec <<< FAILURE! - in TestSuite
testSystemProperties(io.swagger.codegen.cmd.GenerateTest)  Time elapsed: 0.008 sec  <<< FAILURE!
java.lang.IllegalStateException: Missing invocation to mocked type at this point; please make sure such invocations appear only after the declaration of a suitable mock field or parameter
        at io.swagger.codegen.cmd.GenerateTest$3.<init>(GenerateTest.java:109)
        at io.swagger.codegen.cmd.GenerateTest.testSystemProperties(GenerateTest.java:107)

testVerbose_LongArg(io.swagger.codegen.cmd.GenerateTest)  Time elapsed: 0.001 sec  <<< FAILURE!
java.lang.IllegalStateException: Missing invocation to mocked type at this point; please make sure such invocations appear only after the declaration of a suitable mock field or parameter
        at io.swagger.codegen.cmd.GenerateTest$5.<init>(GenerateTest.java:236)
        at io.swagger.codegen.cmd.GenerateTest.doVerboseTest(GenerateTest.java:234)
        at io.swagger.codegen.cmd.GenerateTest.testVerbose_LongArg(GenerateTest.java:61)

testVerbose_ShortArg(io.swagger.codegen.cmd.GenerateTest)  Time elapsed: 0.001 sec  <<< FAILURE!
java.lang.IllegalStateException: Missing invocation to mocked type at this point; please make sure such invocations appear only after the declaration of a suitable mock field or parameter
        at io.swagger.codegen.cmd.GenerateTest$5.<init>(GenerateTest.java:236)
        at io.swagger.codegen.cmd.GenerateTest.doVerboseTest(GenerateTest.java:234)
        at io.swagger.codegen.cmd.GenerateTest.testVerbose_ShortArg(GenerateTest.java:56)


Results :

Failed tests: 
  GenerateTest.testSystemProperties:107 » IllegalState Missing invocation to moc...
  GenerateTest.testVerbose_LongArg:61->doVerboseTest:234 » IllegalState Missing ...
  GenerateTest.testVerbose_ShortArg:56->doVerboseTest:234 » IllegalState Missing...

Tests run: 22, Failures: 3, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] swagger-codegen-project ........................... SUCCESS [2.531s]
[INFO] swagger-codegen (core library) .................... SUCCESS [53.443s]
[INFO] swagger-codegen (executable) ...................... FAILURE [2.318s]
[INFO] swagger-codegen (maven-plugin) .................... SKIPPED
[INFO] swagger-generator ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

@wing328
Copy link
Contributor

wing328 commented Aug 31, 2015

@ePaul it's working fine in my Mac. I'm now doing a test in Ubuntu (virtualbox vm)

@wing328
Copy link
Contributor

wing328 commented Aug 31, 2015

@ePaul I'm able to repeat the issue in the Linux VM. While we're looking into the issue, I wonder if you can try mvn clean install -DskipTests as a workaround to see if it works for you.

cc @Helmsdown

@wing328
Copy link
Contributor

wing328 commented Aug 31, 2015

@ePaul I updated pom.xml with the latest version of jmockit (1.19):

        <jmockit-version>1.19</jmockit-version>

and no longer encounter the same error (the build is now successful). Can you try to see if that fixes the issue for you as well?

(Tested jmockit 1.9 with swagger-codegen on Mac and the result is good too)

@ePaul
Copy link
Contributor Author

ePaul commented Aug 31, 2015

Yup, it works with -DskipTests, it works when omitting the -cli project (mvn clean install -pl moduless/swagger-codegen-maven-plugin -am), it works with JMockit 1.19.

Thanks.

@wing328
Copy link
Contributor

wing328 commented Aug 31, 2015

Thanks for the confirmation. I'll file a PR to fix the issue in master

@Helmsdown
Copy link
Contributor

@wing328 I hope you didnt have to debug this for very long. Sorry for any frustration.

@wing328
Copy link
Contributor

wing328 commented Sep 1, 2015

@Helmsdown it's fine 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants