Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JAXB dependencies from javax to jakarta #553

Open
janosch24 opened this issue Dec 7, 2024 · 2 comments
Open

Update JAXB dependencies from javax to jakarta #553

janosch24 opened this issue Dec 7, 2024 · 2 comments

Comments

@janosch24
Copy link
Contributor

janosch24 commented Dec 7, 2024

Problem or use case

Incorporating EmbeddedHiveMQ into frameworks like Spring Boot 3 leads to clashes regarding the JAXB implementation for config file reading, as dependencies are generally managed by Spring Boot.
As a work-around, required dependencies must get downgraded manually in order to make EmbeddedHiveMQ work.
This in turn leads to clashes in conjunction with other state-of-the-art components.

Motivation

  • Java EE has been rebranded to Jakarta EE several years ago, relocating packages from javax.xml.bind to jakarta.xml.bind
  • No drawbacks expected on the stand-alone version of HiveMQ-CE , as all dependencies are packed into a shadowed jar
  • No manual downgrade of JAXB dependencies for Spring Boot 3
  • Possible drawbacks in OSGi frameworks easily resolvable on a per-bundle-basis

Possible drawbacks

  • Requirement to upgrade dependencies and possibly code to jakarta-style JAXB on other systems using EmbeddedHiveMQ

Preferred solution or suggestions

  • for dependency jaxb-api use package: jakarta.xml.bind:jakarta.xml.bind-api:4.0.2
  • for dependency jaxb-impl use package: org.glassfish.jaxb:jaxb-runtime:4.0.5
  • Refactoring of all import statement from javax.xml.bind to jakarta.xml.bind
@janosch24
Copy link
Contributor Author

Tested suggested solution locally, all tests passed.
Tested outcomings in current Spring Boot 3.4.0, works as expected, no downgrade of JAXB dependencies required anymore.
If desired and appropriate I can make a pull request.

@bchristensen-itron
Copy link

+1 on upgrading to Jakarta dependencies. I encountered the same problem trying to use HiveMQ Community Edition in embedded mode in a Spring Boot 3 application. I was able to work around this using Eclipse Transformer to convert the HiveMQ jar and replace javax with Jakarta, and override the HiveMQ dependencies to more modern versions:

    <!-- Needed for HiveMQ update to Jakarta -->
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
      <version>4.0.2</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <version>4.0.5</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>jakarta.inject</groupId>
      <artifactId>jakarta.inject-api</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice</artifactId>
      <version>7.0.0</version>
    </dependency>

This seems to work but I don’t know if there will be other runtime issues, and it’s required me to add a lot of manual steps to my project’s POM. It would be really nice if HiveMQ could update to modern Jakarta dependencies so this isn’t a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants