[comixed-dev] Re: Upgrading to Java12 for 0.7

  • From: "bareheiny" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "bareheiny" for DMARC)
  • To: comixed-dev@xxxxxxxxxxxxx
  • Date: Tue, 16 Jun 2020 12:21:22 +1200

What version of H2 is being used for 0.7 onwards?

On 14/06/2020, at 11:18, bareheiny <bareheiny@xxxxxxxxx> wrote:


For sure there’s some change between the H2 driver that CX used, and later 
versions.

If you access H2 via an SQL client (I use workbench) you’ll likely need to 
grab the appropriate driver as well and update the connection.

On 14/06/2020, at 09:09, Darryl L. Pierce <mcpierce@xxxxxxxxx> wrote:


Yeah, I hate when upgrading causes things to break due to the dependencies 
being different. I upgraded our Spring Boot dependency to 2.3.1.RELEASE 
which is what pushed us up to Mockito 3 since that's what they depend on.

Fortunately I was able to work around the need for PowerMockito by hiding 
those static method calls in the Utils class. So now the Java12 migration 
works and I've merged it into develop. :D

A note of caution for everybody: you now won't be able to use the 0.6 and 
0.7 release interchangeably. Upgrading Spring upgraded H2 and that's going 
to cause your embedded database file to be migrated when you run 0.7. And I 
don't believe 0.6 will be able to read them. I'd recommend using a MySQL 
server or something else standalone if possible: I use MySQL and it didn't 
have a problem switching between 0.6 and 0.7.

On Sat, Jun 13, 2020 at 4:19 PM Frédéric Fouret <fouretfrederic@xxxxxxxxx> 
wrote:
Hi,
I don't know why we have the error. But while searching I found several 
elements that could be interesting. 
First, it seems that PowerMock doesn't work with Mockito 3.x (see : 
https://github.com/powermock/powermock/issues/1055
Secondly, it seems that our version of PowerMock is a bit old. We are using 
version 2.0.0. It seems that the PowerMockAgent does not support java >=10 
(see : https://github.com/powermock/powermock/issues/979). This is fixed in 
version 2.0.2. I don't really know if the PowerMockAgent is being used and 
if this could be the cause of the problem... but maybe an upgrade should be 
tested (and if the first point with Mockito version 3.x is not already 
blocking itself).

Le sam. 13 juin 2020 à 18:33, Darryl L. Pierce <mcpierce@xxxxxxxxx> a 
écrit :
I ended up removing the testing of static methods in the JUnit tests and 
wrapped the calls in our Utils class. That way I was able to just use 
Mockito directly in those tests. What a PITA.

On Sat, Jun 13, 2020 at 9:35 AM Darryl L. Pierce <mcpierce@xxxxxxxxx> 
wrote:
Correction: this appears to be an issue with PowerMockito rather than 
Mockito.

On Sat, Jun 13, 2020 at 9:16 AM Darryl L. Pierce <mcpierce@xxxxxxxxx> 
wrote:
I started working on this issue today since, by the time 0.7 will get 
released, Github is dropping support for building artifacts with Java8. 
So it's pretty import to get this done before we do any more coding in 
Java.

I'm hitting an issue, though, with Mockito 3.3.3 in the comixed-services 
module. Specifically I"m seeing, when running the JUnit test suite for 
LibraryService, the following runtime error:

java.lang.NoClassDefFoundError: Could not initialize class 
org.comixed.service.library.ReadingListService$MockitoMock$1837613629

at 
jdk.internal.reflect.GeneratedSerializationConstructorAccessor5.newInstance(Unknown
 Source)
at 
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at 
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at 
org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)

And I'm not sure exactly why it's doing this. The class is says it can't 
find (ReadingListService) is in the same package as the test class and 
the class being tested.

Has anybody else seen this issue? Do you know the fix for it?

-- 
Darryl L. Pierce <mcpierce@xxxxxxxxx>
"Le centre du monde est partout." - Blaise Pascal
"Let's try and find some point of transcendence and leap together." - 
Gord Downie


-- 
Darryl L. Pierce <mcpierce@xxxxxxxxx>
"Le centre du monde est partout." - Blaise Pascal
"Let's try and find some point of transcendence and leap together." - 
Gord Downie


-- 
Darryl L. Pierce <mcpierce@xxxxxxxxx>
"Le centre du monde est partout." - Blaise Pascal
"Let's try and find some point of transcendence and leap together." - Gord 
Downie


-- 
Darryl L. Pierce <mcpierce@xxxxxxxxx>
"Le centre du monde est partout." - Blaise Pascal
"Let's try and find some point of transcendence and leap together." - Gord 
Downie

Other related posts: