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

Support compiling and using ShardingSphere under OpenJDK 23 #33025

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

linghengqian
Copy link
Member

@linghengqian linghengqian commented Sep 27, 2024

For #32927.

Changes proposed in this pull request:


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.

Copy link
Member Author

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • More errors surfaced.
Caused by: java.lang.ClassNotFoundException: javax.management.loading.PrivateMLet
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528)
        ... 44 more

Copy link
Member Author

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package javax.management.loading;

/**
 * An MLet that is not added to the {@link ClassLoaderRepository}.
 * This class acts exactly like its parent class, {@link MLet}, with
 * one exception.  When a PrivateMLet is registered in an MBean
 * server, it is not added to that MBean server's {@link
 * ClassLoaderRepository}.  This is true because this class implements
 * the interface {@link PrivateClassLoader}.
 *
 * @deprecated This API is part of Management Applets (m-lets), which is a legacy feature that allows loading
 * of remote MBeans. This feature is not usable without a Security Manager, which is deprecated and subject to
 * removal in a future release. Consequently, this API is also deprecated and subject to removal. There is no replacement.
 *
 * @since 1.5
 */
@Deprecated(since="20", forRemoval=true)
@SuppressWarnings({"serial", "removal"}) // Externalizable class w/o no-arg c'tor
public class PrivateMLet extends MLet implements PrivateClassLoader {

@linghengqian linghengqian force-pushed the fix-jdk23 branch 2 times, most recently from e31270e to 24982ea Compare October 11, 2024 07:09
@linghengqian linghengqian changed the title Support building with OpenJDK23 Support compiling and using ShardingSphere under OpenJDK 23 Oct 11, 2024
@linghengqian linghengqian marked this pull request as ready for review October 11, 2024 07:25
@iamhucong iamhucong merged commit a22d6df into apache:master Oct 11, 2024
141 checks passed
@linghengqian linghengqian deleted the fix-jdk23 branch October 11, 2024 08:00
@linghengqian linghengqian added this to the 5.5.1 milestone Oct 11, 2024
@RaigorJiang
Copy link
Contributor

RaigorJiang commented Oct 12, 2024

Hi @linghengqian

When I use JDK 17 (Zulu) to compile the master branch, this error occurs:

img_v3_02fj_c7f41f6f-ef78-4277-bd3b-8bc654ad5f0g


If I switch to JDK 21, the compilation is successful. Since the -proc option is specified, does it mean that JDK 21 or above must be used to compile ShardingSphere?

@linghengqian
Copy link
Member Author

If I switch to JDK 21, the compilation is successful. Since the -proc option is specified, does it mean that JDK 21 or above must be used to compile ShardingSphere?

@RaigorJiang
Copy link
Contributor

@linghengqian I used the following command to compile and compare the result of different JDKs

./mvnw clean install -B -DskipTests

1. Oracle JDK 17

image
  • Compile failed
image

2. Zulu JDK 17

image
  • Compile failed
image

3. Oracle JDK 21 (In Zulu JDK 21 is also successful, omitted here)

image
  • Compile successful
image

@RaigorJiang
Copy link
Contributor

RaigorJiang commented Oct 12, 2024

After upgrading JDK from 17.0.9 to 17.0.11, there is indeed no problem anymore, thank you @linghengqian

@linghengqian
Copy link
Member Author

linghengqian commented Oct 12, 2024

After upgrading JDK from 17.0.9 to 17.0.11, there is indeed no problem anymore, thank you @linghengqian

  • Maybe some contributors are using non-LTS versions lower than JDK21. Currently, the master branch can only be built with jdk8, jdk11, jdk17, and jdk21-23. I set this JVM parameter in Support building Example module with OpenJDK 23 #33224 to take effect only on JDK23. This will allow contributors to build shardingsphere with jdk15, jdk20, etc.

@RaigorJiang
Copy link
Contributor

After upgrading JDK from 17.0.9 to 17.0.11, there is indeed no problem anymore, thank you @linghengqian

  • Maybe some contributors are using non-LTS versions lower than JDK21. Currently, the master branch can only be built with jdk8, jdk11, jdk17, and jdk21-23. I set this JVM parameter in Support building Example module with OpenJDK 23 #33224 to take effect only on JDK23. This will allow contributors to build shardingsphere with jdk15, jdk20, etc.

Great, thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: build type: dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants