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

addjaxwsruntime recipes breaks Java 8 applications making use of the Jakarta namespace #621

Open
cjobinabo opened this issue Dec 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cjobinabo
Copy link
Contributor

cjobinabo commented Dec 5, 2024

What version of OpenRewrite are you using?

I am using

  • rewrite-rewrite-migrate-java 2.30.1

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

What is the smallest, simplest way to reproduce the problem?

A user has a Java 8 application that was attempting to migrate from Java 8 to Java 21. This app was already making use of the Jakarta EE namespace (Jakarta EE 9 supports Java 8), which was resolved by a dependency the app already had configured as a dependency. After running the java upgrade recipes against the app, they started seeing the following error:

[INFO] Compiling 138 source files with javac [debug deprecation release 21] to target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /C:/MyData/MyWDTWorkspaces/GarageSale/GS-WCA4EJ/garageSale-ee/GarageSaleWSClient/src/main/java/com/ibm/websphere/svt/gs/ccdb/jaxws/client/GarageSaleCCManagerLocal.java:[9,19] package jakarta.jws does not exist
[ERROR] /C:/MyData/MyWDTWorkspaces/GarageSale/GS-WCA4EJ/garageSale-ee/GarageSaleWSClient/src/main/java/com/ibm/websphere/svt/gs/ccdb/jaxws/client/GarageSaleCCManagerLocal.java:[10,19] package jakarta.jws does not exist
[ERROR] /C:/MyData/MyWDTWorkspaces/GarageSale/GS-WCA4EJ/garageSale-ee/GarageSaleWSClient/src/main/java/com/ibm/websphere/svt/gs/ccdb/jaxws/client/GarageSaleCCManagerLocal.java:[11,19] package jakarta.jws does not exist
[ERROR] /C:/MyData/MyWDTWorkspaces/GarageSale/GS-WCA4EJ/garageSale-ee/GarageSaleWSClient/src/main/java/com/ibm/websphere/svt/gs/ccdb/jaxws/client/GarageSaleCCManagerLocal.java:[12,19] package jakarta.jws does not exist
[ERROR] /C:/MyData/MyWDTWorkspaces/GarageSale/GS-WCA4EJ/garageSale-ee/GarageSaleWSClient/src/main/java/com/ibm/websphere/svt/gs/ccdb/jaxws/client/GarageSaleCCManagerLocal.java:[18,2] cannot find symbol

Here is my colleagues assessment of the issue here:

That recipe adds in the jaxws-rt dependency.
I don't have a full understanding of what is happening here, but I think that dependency assumes that the javax namespace is still being used. As per the documentation in the recipe "The resulting dependencies still use the javax namespace, despite the move to the Jakarta artifact."

However, in the case of this application, its already a Jakarta application on Java 8. The jakarta namespace is already in use (from the dependency that it already has: jakarta.xml.ws-api). Adding the new dependency: jaxws-rt in some sense seems to make the jakarta namespace invisible.
If I update the version of the dependency that the recipe adds - from 2.3.7 to the latest, 4.0.3, then it compiles.

Jakarta 9 is compatible with Java SE 8, so we should expect that Java SE 8 application could already be using the jakarta namespace. In which case, it is not always appropriate to add the old version of jaxws-rt- right? That is to say, if the application is already a Jakarta 9 application (on Java SE 8), then this recipe should either not add the 2.3.7 version of jaxws-rt, OR, maybe it should replace the jakarta.xml.ws-api dependency with a newer version of jaxws-rt.

@cjobinabo cjobinabo added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant