Discussion:
WO and Java 11
Hugi Thordarson
2018-10-05 19:13:40 UTC
Permalink
So… Java is moving forward pretty fast these days. I'd like to move to 11 ASAP but I just wanted to check with the community first. Any luck?

- hugi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-***@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/uoh8%40ml-in.narkive.net

Thi
Henrique Prange
2018-10-16 23:49:10 UTC
Permalink
Hi Hugi,

I did some experiments using Java 11 last weekend. I've tried to migrate our main application. It's a large app containing approximately 7200 unit tests. I was expecting lots of issues. Surprisingly, though, I found just a handful of them.

1. WOInject doesn't work

The custom classloader used by WOInject doesn't work with Java 11. Fortunately, there's already a pull request [1] with the fix. Version 1.3-SNAPSHOT based on that branch has been deployed to the WOCommunity repository if anyone wants to try it.

2. Classpath resources not found while executing tests

Tests stoped finding resources in the classpath. Probably because of the new module system and its side-effects. I had to replace code like this:

URL url = TestClass.class.getClass().getResource("/MyResource");

With code like that:

URL url = Thread.currentThread().getContextClassLoader().getResource("MyResource");

3. Socket timeouts when running SMTP related unit tests

It's not related to WO stuff, but SMTP related unit tests aren't working anymore. I have socket timeouts all the time. I remember having problems when migrating to Java 8 too. A system level configuration solved the issue at the time. It might also be the case with Java 11. I've been ignoring these tests until I find the cause of the problem.

4. Wonder

I haven't spent enough time with Wonder yet. Anyway, I know that the ERExtensions framework has some compilation failures. Even though I haven't tried, I expect frameworks like ERProfiling also to break. Most problems that I had were related to code involving or messing with classloaders.

5. Mockito 1.9.x and Guice 4.0 warning messages

Older versions of Mockito make illegal reflective access to the java.lang.ClassLoader.defineClass method. For now, it is just a warning, but, as they keep alerting, "all illegal access operations will be denied in a future release.” I'm pretty sure the latest version (2.23.0) does solve this problem. Unfortunately, Mockit 2.x isn't compatible with WOUnit yet [2].

The same problem happens with Guice, and the same solution applies. Just upgrade to the latest version (4.2.1).

In summary, depending on your WO app dependencies and if you're not willing to move into the new module system, you might be able to migrate to Java 11 without further ado. I've shared a sample WO app on Github [3] showing how to configure the Maven build to work with Java 11.

Oh! And there's one more thing...

In my experience, Java tooling is still not ready for Java 11. I see errors popping up consistently in the latest release of Eclipse. Usually caused by missing classes that were part of the JDK in previous versions. Other tools refuse entirely to open.

As a workaround, I'm "disabling" Java 11 as the default installation in my system. I did that by appending a ".disabled" extension to the Info.plist at the JDK 11 Contents folder:

/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Info.plist.disabled

I know. It's ugly. Yet, I can build my projects with Java 11 while running my tools on Java 8.

[1]https://github.com/hprange/woinject/pull/15
[2]https://github.com/hprange/wounit/issues/49
[3]https://github.com/hprange/wo-java11-sample

Cheers,

HP
So
 Java is moving forward pretty fast these days. I'd like to move to 11 ASAP but I just wanted to check with the community first. Any luck?
- hugi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
https://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com
Fabian Peters
2018-10-17 06:04:33 UTC
Permalink
Hi Henrique,

Thanks, that sounds quite promising and definitely much better than I would have expected!

Regarding the SMTP issues: If it's not some SMTP code itself you want to test but rather mail sending, check out <https://github.com/lshift/javamail-file-transport>.

Fabian
Post by Henrique Prange
Hi Hugi,
I did some experiments using Java 11 last weekend. I've tried to migrate our main application. It's a large app containing approximately 7200 unit tests. I was expecting lots of issues. Surprisingly, though, I found just a handful of them.
1. WOInject doesn't work
The custom classloader used by WOInject doesn't work with Java 11. Fortunately, there's already a pull request [1] with the fix. Version 1.3-SNAPSHOT based on that branch has been deployed to the WOCommunity repository if anyone wants to try it.
2. Classpath resources not found while executing tests
URL url = TestClass.class.getClass().getResource("/MyResource");
URL url = Thread.currentThread().getContextClassLoader().getResource("MyResource");
3. Socket timeouts when running SMTP related unit tests
It's not related to WO stuff, but SMTP related unit tests aren't working anymore. I have socket timeouts all the time. I remember having problems when migrating to Java 8 too. A system level configuration solved the issue at the time. It might also be the case with Java 11. I've been ignoring these tests until I find the cause of the problem.
4. Wonder
I haven't spent enough time with Wonder yet. Anyway, I know that the ERExtensions framework has some compilation failures. Even though I haven't tried, I expect frameworks like ERProfiling also to break. Most problems that I had were related to code involving or messing with classloaders.
5. Mockito 1.9.x and Guice 4.0 warning messages
Older versions of Mockito make illegal reflective access to the java.lang.ClassLoader.defineClass method. For now, it is just a warning, but, as they keep alerting, "all illegal access operations will be denied in a future release.” I'm pretty sure the latest version (2.23.0) does solve this problem. Unfortunately, Mockit 2.x isn't compatible with WOUnit yet [2].
The same problem happens with Guice, and the same solution applies. Just upgrade to the latest version (4.2.1).
In summary, depending on your WO app dependencies and if you're not willing to move into the new module system, you might be able to migrate to Java 11 without further ado. I've shared a sample WO app on Github [3] showing how to configure the Maven build to work with Java 11.
Oh! And there's one more thing...
In my experience, Java tooling is still not ready for Java 11. I see errors popping up consistently in the latest release of Eclipse. Usually caused by missing classes that were part of the JDK in previous versions. Other tools refuse entirely to open.
/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Info.plist.disabled
I know. It's ugly. Yet, I can build my projects with Java 11 while running my tools on Java 8.
[1]https://github.com/hprange/woinject/pull/15
[2]https://github.com/hprange/wounit/issues/49
[3]https://github.com/hprange/wo-java11-sample
Cheers,
HP
Post by Hugi Thordarson
So… Java is moving forward pretty fast these days. I'd like to move to 11 ASAP but I just wanted to check with the community first. Any luck?
- hugi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
https://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
https://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-***@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/uoh8%40ml-in.narkive.net

This email sent to ***@ml-in.narkiv
Paul Hoadley
2018-10-18 04:36:52 UTC
Permalink
Hi Henrique,
Post by Henrique Prange
1. WOInject doesn't work
The custom classloader used by WOInject doesn't work with Java 11. Fortunately, there's already a pull request [1] with the fix. Version 1.3-SNAPSHOT based on that branch has been deployed to the WOCommunity repository if anyone wants to try it.
For what it's worth, I've been using 1.3-SNAPSHOT in development here all day (albeit only on Java 8). Seems to work just fine.
--
Paul Hoadley
https://logicsquad.net/
https://www.linkedin.com/company/logic-squad/
Hugi Thordarson
2018-10-19 13:24:07 UTC
Permalink
Hi Henrique!

Thanks a lot for sharing your experiences—this is the best news I've heard in a while :). I had the same experience with the tooling, but apparently full Java 11 support is scheduled for the 2018-12 release of Eclipse (https://www.eclipse.org/eclipse/news/4.10/jdt.php). I think I'll wait for that and then migrate a couple of non-critical experimental apps. Christmas will be fun this year.

Cheers,
- hugi
Post by Henrique Prange
Hi Hugi,
I did some experiments using Java 11 last weekend. I've tried to migrate our main application. It's a large app containing approximately 7200 unit tests. I was expecting lots of issues. Surprisingly, though, I found just a handful of them.
1. WOInject doesn't work
The custom classloader used by WOInject doesn't work with Java 11. Fortunately, there's already a pull request [1] with the fix. Version 1.3-SNAPSHOT based on that branch has been deployed to the WOCommunity repository if anyone wants to try it.
2. Classpath resources not found while executing tests
URL url = TestClass.class.getClass().getResource("/MyResource");
URL url = Thread.currentThread().getContextClassLoader().getResource("MyResource");
3. Socket timeouts when running SMTP related unit tests
It's not related to WO stuff, but SMTP related unit tests aren't working anymore. I have socket timeouts all the time. I remember having problems when migrating to Java 8 too. A system level configuration solved the issue at the time. It might also be the case with Java 11. I've been ignoring these tests until I find the cause of the problem.
4. Wonder
I haven't spent enough time with Wonder yet. Anyway, I know that the ERExtensions framework has some compilation failures. Even though I haven't tried, I expect frameworks like ERProfiling also to break. Most problems that I had were related to code involving or messing with classloaders.
5. Mockito 1.9.x and Guice 4.0 warning messages
Older versions of Mockito make illegal reflective access to the java.lang.ClassLoader.defineClass method. For now, it is just a warning, but, as they keep alerting, "all illegal access operations will be denied in a future release.” I'm pretty sure the latest version (2.23.0) does solve this problem. Unfortunately, Mockit 2.x isn't compatible with WOUnit yet [2].
The same problem happens with Guice, and the same solution applies. Just upgrade to the latest version (4.2.1).
In summary, depending on your WO app dependencies and if you're not willing to move into the new module system, you might be able to migrate to Java 11 without further ado. I've shared a sample WO app on Github [3] showing how to configure the Maven build to work with Java 11.
Oh! And there's one more thing...
In my experience, Java tooling is still not ready for Java 11. I see errors popping up consistently in the latest release of Eclipse. Usually caused by missing classes that were part of the JDK in previous versions. Other tools refuse entirely to open.
/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Info.plist.disabled
I know. It's ugly. Yet, I can build my projects with Java 11 while running my tools on Java 8.
[1]https://github.com/hprange/woinject/pull/15 <https://github.com/hprange/woinject/pull/15>
[2]https://github.com/hprange/wounit/issues/49 <https://github.com/hprange/wounit/issues/49>
[3]https://github.com/hprange/wo-java11-sample <https://github.com/hprange/wo-java11-sample>
Cheers,
HP
So
 Java is moving forward pretty fast these days. I'd like to move to 11 ASAP but I just wanted to check with the community first. Any luck?
- hugi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
https://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com <https://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com>
Loading...