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

Failed to update tomcat: Cannot find a (Map) Key deserializer for type [simple type, class com.devonfw.tools.ide.version.VersionRange] #557

Closed
hohwille opened this issue Aug 26, 2024 · 3 comments · Fixed by #617
Assignees
Labels
bug Something isn't working

Comments

@hohwille
Copy link
Member

hohwille commented Aug 26, 2024

Start: Install tomcat
Step 'Install or update software' ended with failure.
Step 'ide (update)' failed: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot find a (Map) Key deserializer for type [simple type, class com.devonfw.tools.ide.version.VersionRange]
 at [Source: (BufferedReader); line: 1, column: 1]
 Step 'Install or update software' failed: null
  Step 'Install tomcat (*)' failed: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot find a (Map) Key deserializer for type [simple type, class com.devonfw.tools.ide.version.VersionRange]
 at [Source: (BufferedReader); line: 1, column: 1]
3 step(s) failed out of 12 steps.
An unexpected error occurred!
We are sorry for the inconvenience.
Please check the error below, resolve it and try again.
If the error is not on your end (network connectivity, lack of permissions, etc.) please file a bug:
https://github.com/devonfw/ide/issues/new?assignees=&labels=bug&projects=&template=bug.md&title=RuntimeException%3A+com.fasterxml.jackson.databind.exc.InvalidDefinitionException%3A+Cannot+find+a+%28Map%29+Key+deserializer+for+type+%5Bsimple+type%2C+class+com.devonfw.tools.ide.version.VersionRange%5D%0A+at+%5BSource%3A+%28BufferedReader%29%3B+line%3A+1%2C+column%3A+1%5D
java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot find a (Map) Key deserializer for type [simple type, class com.devonfw.tools.ide.version.VersionRange]
 at [Source: (BufferedReader); line: 1, column: 1]
        at com.devonfw.tools.ide.tool.Dependency.readJson(Dependency.java:75)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installDependencies(LocalToolCommandlet.java:357)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:160)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:144)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.installTool(LocalToolCommandlet.java:132)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:77)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:180)
        at com.devonfw.tools.ide.commandlet.AbstractUpdateCommandlet.updateSoftware(AbstractUpdateCommandlet.java:170)
        at com.devonfw.tools.ide.commandlet.AbstractUpdateCommandlet.run(AbstractUpdateCommandlet.java:52)
        at com.devonfw.tools.ide.commandlet.UpdateCommandlet.run(UpdateCommandlet.java:29)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:902)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:830)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:88)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:51)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:28)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot find a (Map) Key deserializer for type [simple type, class com.devonfw.tools.ide.version.VersionRange]
 at [Source: (BufferedReader); line: 1, column: 1]
        at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1909)
        at com.fasterxml.jackson.databind.deser.DeserializerCache._handleUnknownKeyDeserializer(DeserializerCache.java:603)
        at com.fasterxml.jackson.databind.deser.DeserializerCache.findKeyDeserializer(DeserializerCache.java:168)
        at com.fasterxml.jackson.databind.DeserializationContext.findKeyDeserializer(DeserializationContext.java:675)
        at com.fasterxml.jackson.databind.deser.std.MapDeserializer.createContextual(MapDeserializer.java:314)
        at com.fasterxml.jackson.databind.DeserializationContext.handleSecondaryContextualization(DeserializationContext.java:861)
        at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:653)
        at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4861)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4731)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3698)
        at com.devonfw.tools.ide.tool.Dependency.readJson(Dependency.java:72)
        ... 15 more


Error: IDEasy failed with exit code 255

Related issues

#131

@hohwille hohwille added the bug Something isn't working label Aug 26, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Aug 26, 2024
@hohwille
Copy link
Member Author

hohwille commented Sep 3, 2024

Cannot find a (Map) Key deserializer for type [simple type, class com.devonfw.tools.ide.version.VersionRange]

@aBega2000 could you have a look. For me this looks like the Jackson ObjectMapper is misconfigured here:
We need to implement a VersionRangeJsonDeserializer that can convert from String to VersionRange.
Otherwise the reading of the dependencies.json files seems broken.

@aBega2000 aBega2000 moved this from 🆕 New to 🏗 In progress in IDEasy board Sep 4, 2024
@hohwille
Copy link
Member Author

Seems to only occur in native image build but not if executed in JVM.

@aBega2000
Copy link
Contributor

Since I couldn't finish this issue before leaving, I am writingthis comment for the next person that is going to work on this issue.

The problem appears to be here :
https://github.com/devonfw/IDEasy/blob/main/cli/src/main/java/com/devonfw/tools/ide/url/model/file/UrlDependencyFile.java#L81C9-L83C10

And the solution will most probably be to make the program "understand" the VersionRange ( which is actually a class created from us, and not a native java class). So basically we need to implement a VersionRangeJsonDeserializer that can convert from String to VersionRange.

There is also this Json Guide that is helpful in this case: https://github.com/devonfw/devon4j/blob/master/documentation/guide-json.asciidoc

@hohwille hohwille assigned hohwille and unassigned aBega2000 Sep 13, 2024
@hohwille hohwille modified the milestone: release:2024.09.002 Sep 13, 2024
hohwille added a commit to hohwille/IDEasy that referenced this issue Sep 13, 2024
hohwille added a commit to hohwille/IDEasy that referenced this issue Sep 13, 2024
hohwille added a commit to hohwille/IDEasy that referenced this issue Sep 13, 2024
hohwille added a commit to hohwille/IDEasy that referenced this issue Sep 13, 2024
hohwille added a commit that referenced this issue Sep 17, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in IDEasy board Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants
@hohwille @aBega2000 and others