Mike Smith
Mike Smith

Reputation: 238

Problem with JHipster Upgrade from 6.1.2 to 6.2.0

I encountered (and resolved) a significant JHipster upgrade error. My questions are simple, but there is a little setup and back story first, so I'm going to break this into pieces.

(0) Dev Environment
(1) Upgrade Problem
(2) Investigation/fix strategy
(3) Solution
(4) Questions


(0) Dev Environment

Windows 10, Gradle 5.4.1, node 10.16.3, npm 6.11.2, yarn 1.16.0, MariaDB 10.3, JDK 11, IntelliJ 2019.2.2, git 2.23.0

My project: monolithic app, using Gradle, Angular, JWT authentication, MariaDB for BOTH test and production, no search.


(1) Upgrade Problem

My code is the 21-Points project as outlined in Matt Raible's book: The JHipster Mini-Book v5.0.3. I started my development with JHipster 6.0. Over the summer, I have periodically reviewed the code, and applied upgrades: 6.0.1 to 6.1.1 to 6.1.2 (in each case, after resolving a handful of conflicts, the project would compile and run without hitch).

Last week, I noticed the release of JHipster 6.2.0. I made a copy/backup of the 6.1.2 working code, updated the generator(npm update -g generator-jhipster), applied the upgrade (jhipster upgrade), resolved the conflicts, and... fail. The stacktrace is fairly long and involved. If anyone likes, I'll add it to the post later. But, essentially, the tests failed, and the application would not launch (resulting only in an error page: "An error has occurred :-(", followed by lengthy text suggesting what might have gone wrong, and suggested fixes).

Reverting to the original code, everything still works. Performing a comparison of the two projects, the only changes are those associated with the upgrade. Being surprised by the failure, I scratched my head, then did the following.


(2) Investigation/fix strategy

At this point I had two versions of my project, which I shall label as: 6.1.2-working (the original code before the upgrade) and 6.2.0-broken (the original code + the Jhipster upgrade).

I created a third new fresh project (which I shall refer to as 6.2.0-fresh) as follows:

I then carried out a diff between 6.1.2-working and 6.2.0-fresh, and migrated the functional changes from 6.1.2-working to 6.2.0-fresh. Eventually, I got the new 6.2.0-fresh to run as expected. Theoretically, I could have left things there, but:

I carried out a diff between the new 6.2.0-fresh and 6.2.0-broken. The ONLY meaningful difference was a change in a particular file: package-lock.json

Simply:

I could now build/run the 6.2.0-broken project without a problem!


(3) Solution

To upgrade from JHipster 6.1.2 to 6.2.0:

Everything should now work nicely.


(4) Questions

Thanks!

Upvotes: 1

Views: 1009

Answers (1)

Jochen Haßfurter
Jochen Haßfurter

Reputation: 915

At least David Steiman ("Xetys", Stream Lead JHipster UAA) knows about the problems with upgrading a jhipster generated application with jhipster upgrade, talked about "the dark side of jhipster" on his speech at JHipster Conf 2019 and presented a solution in a demo: https://www.youtube.com/watch?v=Gg5CYoBdpVo.

I try to follow his advices and not to touch the generated classes and configs - which is even more interesting, if someone tries to connect to two databases and stay upgradeable.

But that may only answer your last question, not the ones to the in-depth bugfix you had to do in this particular upgrade from 6.1.2 to 6.2.0.

Upvotes: 2

Related Questions