OpenApiOptions fails to initialize without jackson-module-kotlin
See original GitHub issueActual behavior (the bug)
When you don’t have jackson-module-kotlin
installed, initializing OpenApiOptions
fails before you can specify a replacement ToJsonMapper
.
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/module/kotlin/ExtensionsKt
at io.javalin.plugin.openapi.jackson.JacksonToJsonMapper.<clinit>(JacksonToJsonMapper.kt:12)
at io.javalin.plugin.openapi.OpenApiOptions.<init>(OpenApiOptions.kt:42)
at io.javalin.plugin.openapi.OpenApiOptions.<init>(OpenApiOptions.kt:48)
at io.javalin.plugin.openapi.OpenApiOptions.<init>(OpenApiOptions.kt:49)
...........registerSwagger(Server.java:171)
..........
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.module.kotlin.ExtensionsKt
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Expected behavior
The OpenApiOptions
should allow me to specify an alternate ToJsonMapper
before trying to initialize the default one provided by the missing jackson-module-kotlin
.
To Reproduce
private void registerSwagger(Javalin app) {
final Info applicationInfo = new Info()
.version("1.0")
.description("My Application");
final OpenApiOptions options = new OpenApiOptions(applicationInfo).path("/swagger-docs");
final Gson gson = new Gson();
options.setToJsonMapper(gson::toJson);
app.config.registerPlugin(new OpenApiPlugin(options));
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
OpenApiOptions fails to initialize without jackson-module-kotlin
When you don't have jackson-module-kotlin installed, initializing OpenApiOptions fails before you can specify a replacement ToJsonMapper .
Read more >openapi springboot generator jackson no String-argument ...
This creates model classes with JsonNullable<String> for nullable fields. However I'm getting a Jackson type definition error while POST request ...
Read more >F.A.Q - Springdoc-openapi
How to Integrate Open API 3 with Spring project (not Spring Boot)?. When your application is using spring without (spring-boot), you need to...
Read more >Micronaut Open API - OpenAPI/Swagger Support
To create a project with OpenAPI/Swagger support using the Micronaut CLI, supply the openapi feature to the features flag. For example:.
Read more >Jackson Dependency Issue in Spring Boot with Maven Build
Jackson is currently the leading option for parsing JSON in Java. ... Could not initialize class com.fasterxml.jackson.databind.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, in the weekend 😃
Hi 😄 Was it fixed? I think I’m still getting the same error:
I’m getting:
My pom.xml section:
Running on openjdk version “1.8.0_222”