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 Spring Boot 3 and jakarta #882

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

joshuapsteele
Copy link

@joshuapsteele joshuapsteele commented Oct 2, 2023

Branch and PR inspired by Issue 869: #869

The goal is to support Spring Boot 3.

  • Bump major version
  • Bump Gradle from 6.9.2 to 8.3
  • Transition from javax to jakarta dependencies

@joshuapsteele joshuapsteele changed the title Bump major version; Update javax to jakarta throughout Support Spring Boot 3 and jakarta Oct 2, 2023
@joshuapsteele joshuapsteele marked this pull request as ready for review October 2, 2023 19:36
@kjthorpe18 kjthorpe18 force-pushed the JAVAX-TO-JAKARTA branch 2 times, most recently from b1b9e32 to 42e3839 Compare October 4, 2023 15:36
@@ -21,7 +21,7 @@ dependencies {
providedCompile 'org.eclipse.microprofile:microprofile:4.0.1'

implementation project(':crnk-setup:crnk-setup-rs')
implementation project(':crnk-setup:crnk-setup-cdi')
// implementation project(':crnk-setup:crnk-setup-cdi')
Copy link

@kjthorpe18 kjthorpe18 Oct 4, 2023

Choose a reason for hiding this comment

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

This, and other commented out cdi-related things is temporary - I was having issues with CDI and decided to focus on other parts. Welcome to any suggestions.

@kjthorpe18
Copy link

ValidationClientModuleFactoryTest > test FAILED
    jakarta.validation.ValidationException: HV000183: Unable to initialize 'jakarta.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead
        at app//org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:211)
        at app//org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:97)
        at app//org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getDefaultMessageInterpolator(AbstractConfigurationImpl.java:575)
        at app//org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getDefaultMessageInterpolatorConfiguredWithClassLoader(AbstractConfigurationImpl.java:834)
        at app//org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getMessageInterpolator(AbstractConfigurationImpl.java:485)
        at app//org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:157)
        at app//org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38)
        at app//org.hibernate.validator.internal.engine.AbstractConfigurationImpl.buildValidatorFactory(AbstractConfigurationImpl.java:453)
        at app//jakarta.validation.Validation.buildDefaultValidatorFactory(Validation.java:103)
        at app//io.crnk.validation.ValidationModule.<init>(ValidationModule.java:23)
        at app//io.crnk.validation.ValidationModule.create(ValidationModule.java:36)
        at app//io.crnk.validation.ValidationModule.create(ValidationModule.java:32)
        at app//io.crnk.validation.internal.ValidationClientModuleFactory.create(ValidationClientModuleFactory.java:10)
        at app//io.crnk.validation.internal.ValidationClientModuleFactory.create(ValidationClientModuleFactory.java:6)
        at app//io.crnk.validation.internal.ValidationClientModuleFactoryTest.test(ValidationClientModuleFactoryTest.java:25)

        Caused by:
        java.lang.NoClassDefFoundError: com/sun/el/ExpressionFactoryImpl
            at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:203)
            ... 14 more

            Caused by:
            java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl
                at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:203)
                ... 14 more

Getting this error from many tests - I tried adding 'jakarta.el:jakarta.el-api:5.0.1' based on stackoverflow questions about the same error (but of the javax variety), but no change. Also open to suggestions.

@kjthorpe18 kjthorpe18 force-pushed the JAVAX-TO-JAKARTA branch 2 times, most recently from 5aebf74 to 35889f3 Compare October 4, 2023 20:02
joshuapsteele and others added 4 commits October 4, 2023 18:56
To be compatible with java version, bump gradle version. Disable some plugins for now to get building
Kyle Thorpe added 7 commits October 4, 2023 19:21
Uncomment CDI dependencies, declare explicit dependency on crnk-setup-cdi in the modules that use it
Copy link
Contributor

@whgibbo whgibbo left a comment

Choose a reason for hiding this comment

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

looks good.. Will check and build and if possible will raise a PR on your branch.

Comment on lines 7 to 10
api 'net.jodah:typetools:0.6.3'
api 'org.slf4j:slf4j-api:2.0.9'
api 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2'
api 'jakarta.validation:jakarta.validation-api:3.0.2'
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth either adding variables for common dependencies or moving them to the root project.

plugins {
id 'java'
id 'java-library'
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth adding back the

sourceCompatibility = 1.17
targetCompatibility = 1.17

Choose a reason for hiding this comment

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

Added and fixed in another location where I simply had 17

Choose a reason for hiding this comment

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

I would suggest that you use this notation:

    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17

compile project(':crnk-gen:crnk-gen-typescript')
compile project(':crnk-gen:crnk-gen-asciidoc')
compile project(':crnk-gen:crnk-gen-openapi')
implementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations'
Copy link
Contributor

Choose a reason for hiding this comment

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

does the version number need to be included here?

Choose a reason for hiding this comment

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

This was actually unneeded as it gets this dependency from other modules. Removed.

Comment on lines 12 to 15
implementation 'io.swagger.core.v3:swagger-integration:2.0.8'
implementation 'io.swagger.core.v3:swagger-core:2.0.8'
implementation 'io.swagger.core.v3:swagger-models:2.0.8'
implementation 'io.swagger.parser.v3:swagger-parser:2.0.8'
Copy link
Contributor

Choose a reason for hiding this comment

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

won't these need to be updated to latest versions, for java 17 compactability ?

Choose a reason for hiding this comment

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

Updated. parser doesn't seem to have a -jakarta variant

compile 'io.swagger.core.v3:swagger-core:2.0.8'
compile 'io.swagger.core.v3:swagger-models:2.0.8'
compile 'io.swagger.parser.v3:swagger-parser:2.0.8'
implementation 'guru.nidi:graphviz-java:0.8.3'
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need upgrading to the latest version ?

Choose a reason for hiding this comment

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

Updated

testCompile project(':crnk-meta')
testCompile project(':crnk-test')
testCompile project(':crnk-data:crnk-data-facet')
testImplementation 'commons-io:commons-io:2.5'
Copy link
Contributor

Choose a reason for hiding this comment

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

seeing different version between builds, should we update all the latest and/or but the version in a variable/property

Choose a reason for hiding this comment

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

Updated to latest throughout

testCompile group: 'net.javacrumbs.json-unit', name: 'json-unit-fluent', version: '1.5.3'
testCompile group: 'nl.jqno.equalsverifier', name: 'equalsverifier', version: '1.7.2'
testCompile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.2.0'
api group: 'junit', name: 'junit', version: '4.12'
Copy link
Contributor

Choose a reason for hiding this comment

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

Should remove the junit4 dependency and update tests to junit 5 ?


compile group: 'io.dropwizard', name: 'dropwizard-core', version: '1.0.0'
implementation group: 'io.dropwizard', name: 'dropwizard-core', version: '1.0.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be updated.

@@ -78,7 +82,7 @@ private synchronized void initImpl() {
} else if (requestFactory instanceof HttpComponentsClientHttpRequestFactory) {
HttpComponentsClientHttpRequestFactory apacheRequestFactory =
(HttpComponentsClientHttpRequestFactory) impl.getRequestFactory();
apacheRequestFactory.setReadTimeout(networkTimeout.intValue());
// apacheRequestFactory.setReadTimeout(networkTimeout.intValue());
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for removing?

Choose a reason for hiding this comment

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

Ah forgot about this one. The method/property were deprecated:

As of version 6.0, setting this property has no effect.
To change the socket read timeout, use SocketConfig.Builder.setSoTimeout(Timeout), supply the resulting SocketConfig to org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder.setDefaultSocketConfig(SocketConfig), use the resulting connection manager for org.apache.hc.client5.http.impl.classic.HttpClientBuilder.setConnectionManager(HttpClientConnectionManager), and supply the built HttpClient to HttpComponentsClientHttpRequestFactory(HttpClient).
Deprecated
as of 6.0, in favor of SocketConfig.Builder.setSoTimeout(Timeout), see above.

compile 'org.assertj:assertj-core:3.9.1'
compile 'org.apache.httpcomponents:httpclient:4.5.2'
implementation 'org.assertj:assertj-core:3.9.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.2'
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move upto client5.httpclient or at least the latest version of 4.5.x

Choose a reason for hiding this comment

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

This is wrapped up in the same changes as #882 (comment). I think bumping up the the latest might be the right move, but haven't gotten too deep into that one yet.

@@ -8,15 +8,11 @@ dependencies {
api 'org.slf4j:slf4j-api:2.0.9'
api 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2'
api 'jakarta.validation:jakarta.validation-api:3.0.2'
api 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'

Choose a reason for hiding this comment

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

This may be a problem, we need jackson to use the jakarta version of this

If excluding crnk-setup-cdi, this allows more tests to pass without javax errors
@kjthorpe18
Copy link

kjthorpe18 commented Oct 19, 2023

I've been excluding crnk-setup-cdi to work on other failures, but when including it, I get test errors when running. I can't figure out where this javax dependency is coming from. Any assistance here would be appreciated!

Edit: see https://stackoverflow.com/questions/77319334/java-lang-noclassdeffounderror-javax-enterprise-context-spi-contextual-when-swi/77512767#77512767, this may be because an external dependency isn't using jakarta yet.

For example:

CdiTransactionRunnerTest > initializationError FAILED
    java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Contextual
        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
        at java.base/java.lang.Class.getConstructor0(Class.java:3578)
        at java.base/java.lang.Class.getConstructor(Class.java:2271)
        at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
        at org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder.buildRunner(DefensiveAllDefaultPossibilitiesBuilder.java:114)
        at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
        at org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder.runnerForClass(DefensiveAllDefaultPossibilitiesBuilder.java:57)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
        at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolveTestClass(ClassSelectorResolver.java:66)
        at org.junit.vintage.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:47)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
        at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
        at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
        at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
        at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:42)
        at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:64)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:134)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:108)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:80)
        at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
        at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
        at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:118)
        at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:93)
        at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:88)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
        at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
        at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
        at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
        at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
        at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
        at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

        Caused by:
        java.lang.ClassNotFoundException: javax.enterprise.context.spi.Contextual
            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:520)
            ... 59 more

@byrondaniels
Copy link

Hello! is this still being worked on? im open to help finish this but i dont want to duplicate work if youre working your way through this already

@kjthorpe18
Copy link

Hello! is this still being worked on? im open to help finish this but i dont want to duplicate work if youre working your way through this already

@byrondaniels Hi! I haven't been able to work on this recently, so feel free to help out if you'd like!

@tory-kk
Copy link

tory-kk commented Jun 21, 2024

Could someone invite me to the repository? Would like to help.

@aawaken
Copy link

aawaken commented Jul 9, 2024

just wanted to give 👍 for very much looking forward to see Crnk moved to Jakarta

@joshuapsteele
Copy link
Author

Neither @kjthorpe18 nor I have touched this in quite some time. We welcome others to join in and carry this forward!

@DerekVonk
Copy link

DerekVonk commented Jul 25, 2024

Neither @kjthorpe18 nor I have touched this in quite some time. We welcome others to join in and carry this forward!

I see it hasn't been touched in some time and also notice the certificates or ownership on the documentation website is changed/no longer working. Do any of you know what needs to be done to fix this or can we consider this orphaned?

@mflorczak
Copy link

Neither @kjthorpe18 nor I have touched this in quite some time. We welcome others to join in and carry this forward!

I see it hasn't been touched in some time and also notice the certificates or ownership on the documentation website is changed/no longer working. Do any of you know what needs to be done to fix this or can we consider this orphaned?

I think nobody has access to this repository to merge PR so I think it was orphaned. Maybe we need create fork from this repo and start new product. Idea with crnk was preaty good but we have to migrate it to spring 3.

@tory-kk
Copy link

tory-kk commented Sep 4, 2024

Our team has prepared a separate PR with build fixes for the current PR. Could anyone please review and merge it?
joshuapsteele#3

@joshuapsteele @kjthorpe18 @whgibbo

@mflorczak
Copy link

Our team have prepared a separate PR with build fixes for the current PR. Could anyone please review and merge it? joshuapsteele#3

I think nobody have permission to accept and merge it.

@kjthorpe18
Copy link

I've merged @tory-kk's fixes into this branch, but as mentioned above I think the overall project is unmaintained, and I'm not sure who will have permission to approve & merge this PR.

@tory-kk
Copy link

tory-kk commented Sep 9, 2024

@kjthorpe18 thank you :) What else remains to be done to prepare the branch for the merge and release?
@remmeier would you be able to merge and release a new version when the PR is ready?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants