evainga / rememberbrall

A tiny little programme which helps to remember interesting stuff.
2 stars 1 forks source link

Update to Java 9 #7

Closed evainga closed 5 years ago

evainga commented 7 years ago

https://wiki.eclipse.org/Configure_Eclipse_for_Java_9

mle-enso commented 7 years ago

Please let me know how the upgrade works in conjunction with Lombok.

Some people already share the current status of the Lombok issue with Java 9 here: https://stackoverflow.com/questions/41520511/does-project-lombok-support-java-9

evainga commented 7 years ago

I (successfully?) integrated JDK-9 in my eclipse project and found out how to start it with maven without having switched my maven java version to jdk9 so that my other projects still run with maven java 8. Therefore I'm temporarily using this command: JAVA_HOME=/usr/lib/jvm/java-9-oracle/jdk-9.0.1 mvn -settings ~/.m2/settings-central.xml clean verify

But still I get a build failure. In the beginning a warning pops out:

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

This is also an issue here: https://github.com/google/guice/issues/1133

In the end I get this:

2017-10-31 19:05:33.570 INFO 29335 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 38429 (http) 2017-10-31 19:05:33.578 INFO 29335 --- [ main] d.r.RememberbrallDocumentation : Started RememberbrallDocumentation in 4.579 seconds (JVM running for 5.619) Tests run: 5, Failures: 5, Errors: 0, Skipped: 0, Time elapsed: 5.611 sec <<< FAILURE! - in de.rememberbrall.RememberbrallDocumentation createEntry(de.rememberbrall.RememberbrallDocumentation) Time elapsed: 0.147 sec <<< FAILURE! java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at de.rememberbrall.RememberbrallDocumentation.getPlainRequestSpec(RememberbrallDocumentation.java:48) at de.rememberbrall.RememberbrallDocumentation.createEntry(RememberbrallDocumentation.java:98) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at de.rememberbrall.RememberbrallDocumentation.getPlainRequestSpec(RememberbrallDocumentation.java:48) at de.rememberbrall.RememberbrallDocumentation.createEntry(RememberbrallDocumentation.java:98) deleteNewlyCreatedEntry(de.rememberbrall.RememberbrallDocumentation) Time elapsed: 0 sec <<< FAILURE! java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured at de.rememberbrall.RememberbrallDocumentation.getPlainRequestSpec(RememberbrallDocumentation.java:48) at de.rememberbrall.RememberbrallDocumentation.deleteNewlyCreatedEntry(RememberbrallDocumentation.java:127) deleteNonExistingEntry(de.rememberbrall.RememberbrallDocumentation) Time elapsed: 0 sec <<< FAILURE! java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured at de.rememberbrall.RememberbrallDocumentation.getPlainRequestSpec(RememberbrallDocumentation.java:48) at de.rememberbrall.RememberbrallDocumentation.deleteNonExistingEntry(RememberbrallDocumentation.java:117) showAllEntries(de.rememberbrall.RememberbrallDocumentation) Time elapsed: 0.001 sec <<< FAILURE! java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured at de.rememberbrall.RememberbrallDocumentation.getPlainRequestSpec(RememberbrallDocumentation.java:48) at de.rememberbrall.RememberbrallDocumentation.showAllEntries(RememberbrallDocumentation.java:57) showSpecificEntry(de.rememberbrall.RememberbrallDocumentation) Time elapsed: 0.001 sec <<< FAILURE! java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured at de.rememberbrall.RememberbrallDocumentation.getPlainRequestSpec(RememberbrallDocumentation.java:48) at de.rememberbrall.RememberbrallDocumentation.showSpecificEntry(RememberbrallDocumentation.java:78) 2017-10-31 19:05:33.866 INFO 29335 --- [ Thread-2] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@53d1b9b3: startup date [Tue Oct 31 19:05:29 CET 2017]; root of context hierarchy

Results :

Failed tests: RememberbrallDocumentation>AbstractTestNGSpringContextTests.run:187->createEntry:98->getPlainRequestSpec:48 » NoClassDefFound RememberbrallDocumentation>AbstractTestNGSpringContextTests.run:187->deleteNewlyCreatedEntry:127->getPlainRequestSpec:48 » NoClassDefFound RememberbrallDocumentation>AbstractTestNGSpringContextTests.run:187->deleteNonExistingEntry:117->getPlainRequestSpec:48 » NoClassDefFound RememberbrallDocumentation>AbstractTestNGSpringContextTests.run:187->showAllEntries:57->getPlainRequestSpec:48 » NoClassDefFound RememberbrallDocumentation>AbstractTestNGSpringContextTests.run:187->showSpecificEntry:78->getPlainRequestSpec:48 » NoClassDefFound

Tests run: 5, Failures: 5, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE

What can I do?

mle-enso commented 7 years ago

Jdk9 introduces a rather strict modularization concept and prohibits extensive use of reflection. Both things are needed when @Inject should work. Apart from waiting and studying the information e.g. here https://github.com/google/guice/issues/1085 there is not much more you can do.

evainga commented 5 years ago

This can be closed as rememberbrall is now successfully migrated to java 11 with commits 4765b17 and 858adc5

evainga commented 5 years ago

I forgot to update to java 11 on Heroku, too . This is now also done with commit 6f59d6676a

Unfortunately the openjdk version zulu-11 seems not to bee supported yet and I used oracle jdk instead. I will open a new issue for that and keep an eye on it so that I can change it as soon as possible. see article on Heroku and Java versions