1

I am currently trying to migrate our product from Jakarta EE 8 to Jakarta EE 10. According to the namespace changes of Jakarta APIs I've decided to use intellij Migration tool. After that when I tried to build the application I found out following problem.

We are using 3rd party dependency which has class let's say Person. All constructors of particular class throw javax.activation.MimeTypeParseException

We had a class Student which extends class Person so after migration, our class is importing exception class from the new namespace -> jakarta.activation.MimeTypeParseException;

import jakarta.activation.MimeTypeParseException;

public class Student extends Person {

  public Student(String name) throws MimeTypeParseException {
    super(name);
  }
}

Having the constructor like this, calling super is throwing error: Unhandled exception javax.activation.MimeTypeParseException

I've tried to use the newest version of 3rd party package but it still uses the old Javax namespace.

Is there somebody with a similar experience? Or do you know how to solve that, without downloading 3rd party and migrating also its code?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
bednarb
  • 89
  • 1
  • 6
  • (1) what is `uses the old Jakarta namespace` ? (2) jakarta.activation.MimeTypeParseException come from `jakarta.activation-2.0.1.jar`, it come from jakarta.mail. (3) Old `javax.activation.MimeTypeParseException` come from `activation-1.1.jar` it come from `javax.mail` (4) dirty way , maybe include dependency ( com.sun.mail javax.mail 1.6.2 ) (4) new one is add ( com.sun.mail jakarta.mail 2.0.1 ) – life888888 Jan 18 '23 at 08:40
  • of course, I have updated versions of used dependencies, e.g. `jakarta.mail`. Regarding your second suggestion, I thought about that too, but as I need to migrate also to a new server version, this server version doesn't support Jakarta version older than 9 (with package names javax...). So adding particular dependency wouldn't help – bednarb Jan 18 '23 at 09:02

1 Answers1

1

In case somebody will face this problem, I've found a tool that can help with that problem if you have a 3rd party .jar file.

The Transformer tool offers renaming packages within the .jar archive. Renaming is defined in configuration files(e.g. jakarta-renames.properties) so you can customize them. For me, the default settings were enough.

After cloning and building Transformer you can run it from your terminal:

java -jar ~/org.eclipse.transformer.cli-0.6.0-SNAPSHOT.jar 3rdparty.jar updatedJar.jar -tr jakarta-renames.properties
bednarb
  • 89
  • 1
  • 6