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

tutorial example breaks as soon as you add module-info.java #577

Closed
sdyura opened this issue Sep 24, 2024 · 2 comments
Closed

tutorial example breaks as soon as you add module-info.java #577

sdyura opened this issue Sep 24, 2024 · 2 comments
Assignees
Labels

Comments

@sdyura
Copy link

sdyura commented Sep 24, 2024

I downloaded https://github.com/arangodb/arangodb-java-driver/tree/main/tutorial/maven

and added my projects module-info.java, and the example stopped working

arangodb-java-driver-demo.zip

Exception in thread "main" com.arangodb.ArangoDBException: No JsonFactory found for content type: JSON
	at [email protected]/com.arangodb.serde.jackson.JacksonMapperProvider.of(JacksonMapperProvider.java:50)
	at [email protected]/com.arangodb.serde.jackson.JacksonSerde.of(JacksonSerde.java:26)
	at [email protected]/com.arangodb.serde.jackson.json.JacksonJsonSerdeProvider.create(JacksonJsonSerdeProvider.java:11)
	at [email protected]/com.arangodb.internal.config.ArangoConfig.getUserDataSerde(ArangoConfig.java:265)
	at [email protected]/com.arangodb.internal.config.ArangoConfig.getInternalSerde(ArangoConfig.java:271)
	at [email protected]/com.arangodb.internal.net.Communication.<init>(Communication.java:36)
	at com.arangodb.http.HttpCommunication.<init>(HttpCommunication.java:39)
	at com.arangodb.http.HttpProtocolProvider.createProtocol(HttpProtocolProvider.java:33)
	at [email protected]/com.arangodb.ArangoDB$Builder.build(ArangoDB.java:399)
	at net.yura.arango/net.yura.arango.FirstProject.main(FirstProject.java:25)
@rashtao rashtao self-assigned this Sep 25, 2024
@rashtao rashtao added the bug label Sep 25, 2024
@rashtao
Copy link
Collaborator

rashtao commented Sep 25, 2024

Thanks for reporting, @sdyura

This caused by FasterXML/jackson-core#1340 and needs to be fixed and backported in Jackson core.

For the moment, to work-around either:

  • do not require Jackson in your module-info.java (and remove related code usages), or
  • use the shaded Java driver (com.arangodb:arangodb-java-driver-shaded) and the shaded Jackson classes (from package com.arangodb.shaded.fasterxml.jackson), or
  • use the shaded Java driver (com.arangodb:arangodb-java-driver-shaded) and the Jackson JSON serde (com.arangodb:jackson-serde-json) and manually configure the JSON serde:
          JsonFactory jf = new JsonFactory();
          JacksonUtils.tryConfigureJsonFactory(jf);
          ObjectMapper mapper = new ObjectMapper(jf);
          JacksonSerde serde = JacksonSerde.create(mapper);
    
          arangoDB = new ArangoDB.Builder()
                  // ...
                  .serde(serde)
                  .build();

@rashtao
Copy link
Collaborator

rashtao commented Oct 22, 2024

Fixed in Jackson 2.18 and released in ArangoDB Java driver 7.10.0: https://github.com/arangodb/arangodb-java-driver/releases/tag/v7.10.0

Feel Free to reopen in case of further problems.

@rashtao rashtao closed this as completed Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants