java - NoClassDefFoundError when deploying Wiremock in Docker container -
i have wiremock project using ivy/ant dependencies/builds. when run launch file in eclipse starts server , requests succeed. when build docker image , run it, crashes immediately.
docker build:
docker build --force-rm -t <repo_location>/assignment_form_api_mock:latest -t <repo_location>/assignment_form_api_mock:1.0.6 .
docker run:
docker run -d --name form-api-mock -p 10404:8080 <repo_location>/assignment_form_api_mock --verbose --extensions="com.gatesbiz.assignmentdispatch.mock.requesttemplatetransformerglobal,com.gatesbiz.assignmentdispatch.mock.adminareasrequesttransformer,com.gatesbiz.assignmentdispatch.mock.formsrequesttransformer,com.gatesbiz.assignmentdispatch.mock.vehiclerequesttransformer"
while loading extensions docker logs stack trace:
2017-08-14 18:05:24.276 verbose logging enabled slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. exception in thread "main" java.lang.noclassdeffounderror: com/fasterxml/jackson/core/type/typereference @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:264) @ com.github.tomakehurst.wiremock.extension.extensionloader$3.apply(extensionloader.java:75) @ com.github.tomakehurst.wiremock.extension.extensionloader$3.apply(extensionloader.java:71) @ wiremock.com.google.common.collect.iterators$8.transform(iterators.java:799) @ wiremock.com.google.common.collect.transformediterator.next(transformediterator.java:48) @ wiremock.com.google.common.collect.transformediterator.next(transformediterator.java:48) @ wiremock.com.google.common.collect.maps.uniqueindex(maps.java:1163) @ wiremock.com.google.common.collect.maps.uniqueindex(maps.java:1140) @ com.github.tomakehurst.wiremock.extension.extensionloader.asmap(extensionloader.java:43) @ com.github.tomakehurst.wiremock.extension.extensionloader.loadextension(extensionloader.java:32) @ com.github.tomakehurst.wiremock.extension.extensionloader.load(extensionloader.java:39) @ com.github.tomakehurst.wiremock.standalone.commandlineoptions.extensionsoftype(commandlineoptions.java:277) @ com.github.tomakehurst.wiremock.core.wiremockapp.<init>(wiremockapp.java:80) @ com.github.tomakehurst.wiremock.wiremockserver.<init>(wiremockserver.java:69) @ com.github.tomakehurst.wiremock.standalone.wiremockserverrunner.run(wiremockserverrunner.java:65) @ com.github.tomakehurst.wiremock.standalone.wiremockserverrunner.main(wiremockserverrunner.java:113) caused by: java.lang.classnotfoundexception: com.fasterxml.jackson.core.type.typereference @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331) @ java.lang.classloader.loadclass(classloader.java:357) ... 17 more
when googled around saw people having version problems jackson: https://github.com/tomakehurst/wiremock/issues/282
for reason i'm using wiremock-standalone. i've tried implicitly overriding the jackson versions ensure same versions of jackson-annotations, jackson-databind, , jackson-core used. if don't add dependencies implicitly same error jars brought in versions:
jackson-annotations-2.1.2.jar jackson-core-2.1.3.jar jackson-databind-2.1.3.jar
ivy dependencies:
<dependencies> <dependency org="com.github.tomakehurst" name="wiremock-standalone" rev="2.7.1" conf="compile->default"/> <dependency org="io.rest-assured" name="rest-assured" rev="3.0.3" conf="test->default"/> <dependency org="com.gatesbiz.common" name="logback_core" rev="2.0.13" conf="compile->compile;test->test"/> <dependency org="commons-io" name="commons-io" rev="2.5"/> <dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.9.0"/> <dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.9.0"/> <dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.9.0"/> </dependencies>
dockerfile:
from rodolpheche/wiremock add src/test/resources /home/wiremock add /bin /var/wiremock/extensions/af-extensions.jar
docker-compose.yml
assignment-form-api-mock: container_name: assignment-form-api-mock image: <repo_location>/assignment-form-api-mock ports: - 10404:8080 command: --extensions="com.gatesbiz.assignmentdispatch.mock.requesttemplatetransformerglobal,com.gatesbiz.assignmentdispatch.mock.adminareasrequesttransformer,com.gatesbiz.assignmentdispatch.mock.formsrequesttransformer,com.gatesbiz.assignmentdispatch.mock.vehiclerequesttransformer"
Comments
Post a Comment