O3-5254: Exclude jackson-dataformat-yaml to prevent bundling Jackson dataformat#689
O3-5254: Exclude jackson-dataformat-yaml to prevent bundling Jackson dataformat#689dkayiwa merged 3 commits intoopenmrs:masterfrom
Conversation
The webservices.rest-omod-common module was packaging `jackson-dataformat-yaml` via swagger-core, which resulted in Jackson artifacts being included in the OMOD. This contributed to classloader conflicts during OpenMRS startup (LinkageError: ObjectReader), especially when demo data generation is enabled. By excluding jackson-dataformat-yaml, the module now defers to the Jackson version provided by the platform/container, preventing duplicate Jackson classes from being shipped inside the OMOD.
|
@jayasanka-sack do you still have the exact class loader error message in the logs? |
|
Hi Daniel, yes I checked the error is now gone ❤️ It is still safe to exclude jackson-dataformat-yaml because the REST module does not depend on YAML serialization for any of its functionality. Swagger and the REST APIs operate entirely on JSON, which is already handled by the Jackson libraries provided by OpenMRS Core. Keeping this dataformat dependency inside the OMOD would re-introduce a separate Jackson artifact into the module classpath, which is exactly the pattern that led to the initial classloader conflict. If YAML support is needed in the future, it should be added at the platform level rather than packaged inside an OMOD. |
| matrix: | ||
| platform: [ ubuntu-latest ] | ||
| java-version: [ 8, 11, 17, 21 ] | ||
| fail-fast: false |
There was a problem hiding this comment.
Not related to the PR, but GitHub rolled out an update to GitHub Action matrices to fail-fast by default. This means that if one job in the matrix fails, it will skip all the in-progress jobs. I noticed the same issue on this PR while working on it, so I turned it off. This way for example if the Java 8 job fails, it won’t stop running jobs for other Java versions.
I did the same for the distro: openmrs/openmrs-distro-referenceapplication#947
Description of what I changed
This PR excludes jackson-dataformat-yaml from the swagger-core dependency in webservices.rest-omod-common. The module was previously bundling its own Jackson YAML library inside the OMOD, which contributed to classloader constraint violations when OpenMRS starts.
Issue I worked on
see https://openmrs.atlassian.net/browse/O3-5254
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amendI have added tests to cover my changes. (If you refactored
existing code that was well tested you do not have to add tests)
No? -> write tests and add them to this commit
git add . && git commit --amendI ran
mvn clean packageright before creating this pull request andadded all formatting changes to my commit.
No? -> execute above command
All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master