spring-projects / spring-projects/spring-modulith

Class loader issues with IBM Open Liberty server

Open
#1,183 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.2k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

In combination with IBM Open Liberty server, I've encountered two problems with Spring Modulith:

  1. Application startup fails with org.springframework.cglib.core.CodeGenerationException: java.lang.IllegalAccessError-->class org.springframework.modulith.events.jdbc.JdbcEventPublicationRepository$$SpringCGLIB$$0 cannot access its superclass org.springframework.modulith.events.jdbc.JdbcEventPublicationRepository.
  2. Uninitialized member variables in Service component with a @ApplicationModuleListener annotated method to consume events cause NullPointerException when accessing said member variables.

While problem 1 can be bypassed with a patched "spring-modulith-events-jdbc-1.3.5.jar" where JdbcEventPublicationRepository is declared public instead of package-private, I don't understand yet the cause for problem 2. It's also possible that this monkey patch even triggers problem 2.

Since Open Liberty is not as common as other servers, I've prepared a small demo project.
The demo application mainly consists of:

  • a Service EventProducer to publish events
  • a Service EventConsumer that consumes the events (using @ApplicationModuleListener)
  • a RestController EventController to trigger the event publication

Building the project with mvn verify will bundle Open Liberty as embedded server (instead of default Tomcat), so one does not require a standalone server installation. The README should hopefully contain enough details. Stack traces for both problems are also included.

I would like to emphasize that these issues only occur with Open Liberty as server runtime, but not with Tomcat. Open Liberty is known to do things differently thread-wise during bootstrapping than other servers (see Spring issue 34729).

Kind regards,
Thomas

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked demo project and its README, then run mvn verify to reproduce the two failures under embedded Open Liberty and compare the result with Tomcat. Review the included stack traces around JdbcEventPublicationRepository and the EventConsumer service. Done means identifying the cause of both class-loader or initialization problems and documenting or implementing a fix that works on Open Liberty without regressing Tomcat.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.