2

I dockerized a spring boot application with Jib. When I run the docker image, I get this error.

Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:158)
    ... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    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)
    ... 25 common frames omitted

However, when I run java -jar application.jar then everything works fine.

What could be missing here?

nirvair
  • 4,001
  • 10
  • 51
  • 85
  • Perhaps the jackson dependency is not being copied into the container due to a configuration issue. Could you file a bug on github and we can try to figure this out? https://github.com/GoogleContainerTools/jib/issues – loosebazooka Sep 20 '19 at 18:06

1 Answers1

0

Check your java version - I had XML problems when I switched from Java 8 to Java 11.

Kieveli
  • 10,944
  • 6
  • 56
  • 81