Open rahulpoddar-fyndna opened 1 year ago
cc @artursouza
There are users already reporting wanting to use Dapr's SDK with Spring Boot 3.0, like in https://github.com/dapr/java-sdk/issues/815
We need to complete this migration but have not started the work yet - I am looking for someone to get this work done. I can accept contribution from the community on this as well.
I have one question about the target of this issue and related PR https://github.com/dapr/java-sdk/pull/894 : after this update, should dapr java sdk
I think the answer should be the second, and also I found some changes in PR to support this idea:
matrix:
- java: [ 11, 13, 15, 16 ]
- spring-boot-version: [ 2.7.8 ]
+ java: [ 11, 13, 15, 16, 17 ]
+ spring-boot-version: [ 2.7.8, 3.1.2 ]
and also :
- java: 11
spring-boot-version: 2.3.6.RELEASE
experimental: false
+ - java: 17
+ spring-boot-version: 3.1.2
+ experimental: false
It seems that we will "ADD" support for java 17 and spirng boot 3.0 and still "keep" support for java 11+ and spring boot 2.
But I found that in the root pom.xml, the value of property springboot.version has simply changed from 2.7.8 to 3.1.2:
- <springboot.version>2.7.8</springboot.version>
+ <springboot.version>3.1.2</springboot.version>
And when I used jdk11 to execute maven command like mvn compile
:
$ sdk current java
Using java version 11.0.20-zulu
# mvn compile
......
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project dapr-sdk-springboot: Compilation failure
[ERROR] Could not load processor class file due to 'org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0'.
So from content of the PR https://github.com/dapr/java-sdk/pull/894, It seems that we will "ONLY" support for java 17 with spring boot 3 after this PR.
That's why I ask this question here: We must clarify or make decision about the target before we go deep into this update.
@artursouza @yaron2 @krizsan please have a look at my above comments and clarify what's your target for spring boot 3.0 support.
I have an suggestion about how to support jdk17/springboot3 in dapr java sdk and also keep supporting jdk11 (even jdk8 if possible) /springboot2:
Let's split current dapr java sdk project.
Background: in current dapr java sdk project, we have several subprojects(ignoring docs/examples/tests): sdk / sdk-autogen / sdk-actors / sdk-workflows and sdk-springboot. Now it's for both pure java and spring boot 2.0, and the jdk version is jdk 11. In fact, jdk 8.0 is also supported.
Now I think our requirement should be both:
And I had confirmed that both maven and gradle can't support to use different version of jdk to diffrent subprojects. So to support both above two requirements, I suggest to split current dapr java sdk project:
After this updating, we will have 3 projects (and also 3 github repos):
dapr/java-sdk
: for pure java only, jdk version should be 8(nice to have) / 11 / 17(need to verify) dapr/dapr-springboot2
: for spring boot 2.0 integration, jdk version should be 8 / 11 (no change)dap/dapr-springboot3
: for spring boot 3.0 integration, jdk version should be 17@skyao - Given the limitations we are running to support both JAVA 17 & 11 the approach proposed you seem to be a best option. I think this approach may introduce some breaking changes to existing projects and can they be avoided?
I agree to have a different project (artifact) for springboot3. Let's keep the current one as-is (without renaming) for backwards compatibility. I don't think there is a need to create new repositories, just new projects under the same parent pom.
So, I recommend creating dapr-springboot3 under the same parent pom.
Hi, @artursouza , I agree with you except that can we have solution to just add dapr-springboot3 with jdk17 in the java-sdk project without upgrade the sdk of the whole project from jdk11 to jdk 17?
I had confirmed that both maven and gradle can't support to use different version of jdk to diffrent subprojects.
Another solution is keeping our jdk strategy in current java-sdk project that using jdk 11 but set source and target to jdk8:
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
We can then using jdk 17 and also set source and target to jdk8 (or jdk11 if jdk 8 not work) . But we should verify it before we make decision.
@krizsan you have coded on jdk17 and change a lot of dapr java-sdk code, would you please give us some suggestion?
I did some test and share the results to you.
First I changed the jdk version to 17 (by sdkman) , and I used jdk17 to execute mvn compile
command in dapr java-sdk project without changing any code.
At first it reported many errors like:
......
[java] Couldn't get class info for java/lang/NumberFormatException
[java] java.lang.IllegalArgumentException: Unsupported class file major version 61
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:189)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:156)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Couldn't get class info for java/lang/AssertionError
[java] java.lang.IllegalArgumentException: Unsupported class file major version 61
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:189)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:156)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Couldn't get class info for java/util/Collections
[java] java.lang.IllegalArgumentException: Unsupported class file major version 61
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:189)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:156)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Couldn't get class info for java/lang/Float
[java] java.lang.IllegalArgumentException: Unsupported class file major version 61
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:189)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:156)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Couldn't get class info for java/util/Set
[java] java.lang.IllegalArgumentException: Unsupported class file major version 61
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:189)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
[java] At org.objectweb.asm.ClassReader.<init>(ClassReader.java:156)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
[java] At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Exception in thread "main" java.lang.IllegalArgumentException: Unsupported class file major version 61
[java] at org.objectweb.asm.ClassReader.<init>(ClassReader.java:189)
[java] at org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
[java] at org.objectweb.asm.ClassReader.<init>(ClassReader.java:156)
[java] at edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
[java] at edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
[java] at edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
[java] at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] at edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
[java] at edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] at edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] at edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] at edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] dapr-sdk-parent 1.10.0-SNAPSHOT .................... SUCCESS [ 1.040 s]
[INFO] dapr-sdk-autogen 1.10.0-SNAPSHOT ................... SUCCESS [ 0.517 s]
[INFO] dapr-sdk 1.10.0-SNAPSHOT ........................... FAILURE [ 1.695 s]
[INFO] dapr-sdk-actors 1.10.0-SNAPSHOT .................... SKIPPED
[INFO] dapr-sdk-workflows 0.10.0-SNAPSHOT ................. SKIPPED
[INFO] dapr-sdk-springboot 1.10.0-SNAPSHOT ................ SKIPPED
[INFO] dapr-sdk-examples 1.10.0-SNAPSHOT .................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.565 s
[INFO] Finished at: 2023-08-22T09:17:53Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:4.1.4:spotbugs (spotbugs) on project dapr-sdk: Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:4.1.4:spotbugs failed: Java returned: 1 -> [Help 1]
And then I removed the plugin of spotbugs in root pom.xml, and tried it again:
mvn compile
......
[INFO] dapr-sdk-parent 1.10.0-SNAPSHOT .................... SUCCESS [ 0.785 s]
[INFO] dapr-sdk-autogen 1.10.0-SNAPSHOT ................... SUCCESS [ 5.076 s]
[INFO] dapr-sdk 1.10.0-SNAPSHOT ........................... SUCCESS [ 1.719 s]
[INFO] dapr-sdk-actors 1.10.0-SNAPSHOT .................... SUCCESS [ 0.321 s]
[INFO] dapr-sdk-workflows 0.10.0-SNAPSHOT ................. SUCCESS [ 0.184 s]
[INFO] dapr-sdk-springboot 1.10.0-SNAPSHOT ................ SUCCESS [ 0.170 s]
[INFO] dapr-sdk-examples 1.10.0-SNAPSHOT .................. SUCCESS [ 0.745 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.523 s
[INFO] Finished at: 2023-08-22T09:20:02Z
[INFO] ------------------------------------------------------------------------
This is a good news for us. It seems that we use this simple solution to upgrade our jdk from 11 to 17 without too many code change. Yet this need more verification.
The jdk I used:
$ java --version
java 17.0.8 2023-07-18 LTS
Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)
$ sdk current java
Using java version 17.0.8-oracle
So from above discussion, it seems that at least we should move spring boot3 support out of dapr java sdk ( to a new repo).
@artursouza Do you agree with this proposal?
@artursouza please have a look at this discussion.
So from above discussion, it seems that at least we should move spring boot3 support out of dapr java sdk ( to a new repo).
@artursouza Do you agree with this proposal?
I don't think we should have a new repo just for springboot3 code - we should find a way to have it here. It is OK if Java17 is required for dev but the artifacts (jars) should be compatible for Java 11.
Is anyone working on dapr-springboot3 project? As discussed here, it can simply be a new artifact in this repo, similar to how dapr-workflow is being versioned.
@skyao - FYA as this is in the priority list to solve it in 1.13 release timeframe.
Is anyone working on dapr-springboot3 project? As discussed here, it can simply be a new artifact in this repo, similar to how dapr-workflow is being versioned.
Hi, Artur, please go this proposal and review it:
https://github.com/dapr/java-sdk/issues/971
After all kinds of testing and validation, I finally found a solution that looks ideal for upgrading jdk17 and springboot 3.0. You can help me to see if this solution will satisfy you.
Dapr java SDK is available with JDK 11 and uses spring boot version 2.7.8 as of now. Spring boot has the release latest version 3.0. In order to move the Spring 3.0 the library has to be supported with JDK 17.
With JDK 17, the java enterprise edition has moved to Jakarta enterprise edition and this needs some code changes as well.Specifically all the javax namespace has moved to Jakarta namespace.
We plan to move to JDK 17 along with Spring Boot 3.0.
Dapr SDK provides sdk-springboot library to support development using spring boot. As of now this library uses spring boot version 2.7.8. sdk-springboot library needs to be supported with latest version of spring boot 3.0.
After successfully moving to JDK 17 and Spring boot 3.0, we will adopt Spring native.