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

com.datastax.oss.driver.internal.core.util.Dependency was unintentionally initialized at build time #1340

Closed
acemoo opened this issue Jan 6, 2023 · 6 comments
Assignees
Labels
for: external-project For an external project and not something we can fix

Comments

@acemoo
Copy link

acemoo commented Jan 6, 2023

When trying to natively compile a project that has both spring-boot-starter-data-cassandra and spring-cloud-starter-stream-kafka using mvn clean -Pnative native:compile
I'm getting the following error:

Error: Classes that should be initialized at run time got initialized during image building:
 com.datastax.oss.driver.internal.core.util.Dependency was unintentionally initialized at build time.

Here's a minimal project that shows the problem: https://github.com/acemoo/spring-native-cloud-kafka-data-cassandra

I found a similar issue with Micronaut micronaut-projects/micronaut-cassandra#263
With a solution https://github.com/micronaut-projects/micronaut-cassandra/pull/264/files
Unfortunately, I couldn't find any --initialize-at-build-time in either Spring Boot or Spring Data Cassandra.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 6, 2023
@mp911de
Copy link
Member

mp911de commented Jan 9, 2023

Please report the issue against the Cassandra driver directly. All those linked tickets seem like workarounds.

Can you attach a trace from where the initialization of Dependency is triggered?

@mp911de mp911de self-assigned this Jan 9, 2023
@mp911de
Copy link
Member

mp911de commented Jan 11, 2023

Initialization stack trace shows that com.datastax.oss.driver.internal.core.util.Dependency is initialized by a substitution shipped in the Cassandra driver:

Error: Classes that should be initialized at run time got initialized during image building:
 com.datastax.oss.driver.internal.core.util.Dependency was unintentionally initialized at build time. com.datastax.oss.driver.internal.core.util.Dependency caused initialization of this class with the following trace: 
	at com.datastax.oss.driver.internal.core.util.Dependency.<clinit>(Dependency.java:33)
	at com.datastax.dse.driver.internal.core.type.codec.DseTypeCodecsRegistrarSubstitutions$EsriMissing.getAsBoolean(DseTypeCodecsRegistrarSubstitutions.java:42)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:1014)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:364)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:342)
	at com.oracle.svm.hosted.NativeImageGenerator.createAnnotationSubstitutionProcessor(NativeImageGenerator.java:966)
	at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:868)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:575)
	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2023
@mp911de mp911de added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 11, 2023
@acemoo
Copy link
Author

acemoo commented Jan 20, 2023

A bit of a slow response from my side, Just got time to dive into this again.
Seems it will be solved in 4.15.1
https://datastax-oss.atlassian.net/browse/JAVA-3045

@mp911de mp911de changed the title Unable to combine Spring Data Cassandra and Spring Cloud Kafka in spring native com.datastax.oss.driver.internal.core.util.Dependency was unintentionally initialized at build time Feb 13, 2023
@patpatpat123
Copy link

Hello @acemoo , thank you for finding this issue.

Do you know if there is a way to import 4.15.1 to the current SpringBoot 3.0.2 or 3.0.3 snapshot please?

@mp911de
Copy link
Member

mp911de commented Feb 15, 2023

4.15.1 isn't released yet. In any case, you can override the Spring Boot property cassandra-driver.version with <cassandra-driver.version>4.15.1</cassandra-driver.version>.

@patpatpat123
Copy link

Many thanks @mp911de, I will wait for the release of 4.15.1 and apply what you said

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

4 participants