1

So I have a small application (not running in a web container) that uses some javax.* classes running on jdk8. The time has come to upgrade to jdk17. So I thought,easy enough, I download the jakarta ee 9 (or 10) reference implementation .jar files, switch in the code javax. to jakarta.* namespace and we are good to go. Seems I can't find where I can download the reference implementation *jar files for jakarta ee 9 (or 10). So obviously I'm missing something. Can someone guide me to the good approach to solve this ?

user1391606
  • 91
  • 1
  • 2
  • 8
  • Jakarta-EE is divided in to bunch of [different specifications](https://jakarta.ee/specifications/) so it could help others to help you if you would tell which one(s) your application uses (e.g Jaxb. CDI or Persistence). Aside from using application server doubt there's any all-in-one package that would contain all Jakarta-EE API's and reference implementations. – Pasi Österman May 10 '22 at 09:32
  • Hi, thx for the comment We were able to download the javax.activation-1.2.0.jar, jaxb-api-2.3.0.jar,jaxb-core-2.3.0.jar,jaxb-impl-2.3.0.jar files based on some other stackoverflow question. I thought there was a reference implementation you could download the *.jars from instead of downloading for example GlassFish or TomEE and then trying to figure out which *.jar files you need !? Or is it wrong using javax(J2EE) packages in a non web application ? – user1391606 May 12 '22 at 07:25

1 Answers1

1

I mostly use maven to handle my dependencies but hope this helps at least a bit.

For jaxb 3.x you can use following api-dependency

<dependency>
    <groupId>jakarta.xml.bind</groupId>
    <artifactId>jakarta.xml.bind-api</artifactId>
    <version>3.0.1</version>
</dependency>

Then for implementation you can use the following.

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>3.0.0</version>
</dependency>

If you need to generate classes from xsd you can use jaxb2-maven-plugin 3.1.0. It seems to only depend on jakarta.xml.bind-api while including rest as nested dependencies.

<!-- 
  by default searches schemas from src/main/xsd 
  and binding files from src/main/xjb
-->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
        <execution>
            <id>xjc</id>
            <goals>
                <goal>xjc</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <packageName>com.example.api</packageName>
    </configuration>
</plugin>

Not sure about javax.activation

Pasi Österman
  • 2,002
  • 1
  • 6
  • 13
  • 1
    Check https://stackoverflow.com/questions/46493613/what-is-the-replacement-for-javax-activation-package-in-java-9 for javax.activation – Tony Yip May 13 '22 at 14:11