chatbot icon indicating copy to clipboard operation
chatbot copied to clipboard

Application Fails to Start in Development/Deployment Mode

Open tech0priyanshu opened this issue 8 months ago • 1 comments

When I run the project in Development mode:

$ mvn spring-boot:run
$ node node_modules/.bin/webpack --env.NODE_ENV=dev --watch

Issue Log:

Image Image Image

When I run the project in Deployment mode:

$ mvn clean install
$ java $JAVA_OPTS -Dserver.port=$PORT -jar target/*.jar

Issue Log:

Image Image

Image

Environment Details:

Maven Version: 3.8.7

Node Version: v22.14.0

NPM/Yarn Version: 10.9.2

Image

tech0priyanshu avatar Apr 25 '25 09:04 tech0priyanshu

I encountered this issue while running a Spring Boot 1.5.2 project on Java 17.

Environment: Java: 17.x Maven: 3.8.7 Node: v22.14.0 NPM: 10.9.2 Spring Boot: 1.5.2.RELEASE Spring Framework: 4.3.7.RELEASE

Error: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(...) because module java.base does not "opens java.lang" to unnamed module This happens because Spring Boot 1.5.x and Spring Framework 4.x rely on CGLIB reflection that’s blocked by Java 17’s module system.

Workarounds I tried:

Running with: mvn spring-boot:run -Dspring-boot.run.jvmArguments="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED" → Works, but only as a temporary hack.

Downgrading to Java 8 → Works, but not ideal.

Permanent Fix: Upgrade to Spring Boot 2.7.x (or newer) which is fully Java 17 compatible. This also updates Spring Framework to 5.x and removes the need for --add-opens.

himeshpathai avatar Aug 13 '25 06:08 himeshpathai