Hi BJ,
while the jakarta classes are not yet available on our class path, I have started looking into Option 2, which is about “preloading” the jakarta classes "by asking the class loader to define the jakarta class with the transformed class file of the javax class".
This looks promising and all goes well until jakarta.servlet.GenericServlet (defined from the transformed byte code of javax.servlet.GenericServlet) is initialized, which throws this error:
Caused by: java.util.MissingResourceException: Can't find bundle for base name jakarta.servlet.LocalStrings, locale en_US
at java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2045)
at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1683)
at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1586)
at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1549)
at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:858)
at jakarta.servlet.GenericServlet.<clinit>(GenericServlet.java:51)
... 18 more
This is because the original javax.servlet.GenericServlet has this static initializer code:
private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
private static ResourceBundle lStrings = ResourceBundle.getBundle(LSTRING_FILE);
I have to check if and how we could trick the class loader (java.util.ResourceBundle) into loading the old javax.servlet.LocalStrings, when the transformed jakarta.servlet.GenericServlet requests jakarta.servlet.LocalStrings - which does not exist anywhere on the class path ...