Hey folks, I’m trying to run WireMock in Docker w...
# general
Hey folks, I’m trying to run WireMock in Docker with the gRPC Extension, but I’m not having any luck. I followed the docs for running WireMock with extensions in Docker by doing the following: 1. Downloading the latest JAR of the extension and moving it to the
directory. 2. Running the following:
Copy code
docker run -it --rm \
  -p 8080:8080      \
  --name wiremock   \
  -v "${PWD}/extensions:/var/wiremock/extensions" \
  wiremock/wiremock:3.3.1                         \
  --extensions "org.wiremock.grpc.GrpcExtensionFactory"
However, this results in the error:
Copy code
Exception in thread "main" java.lang.ClassCastException: class org.wiremock.grpc.GrpcExtensionFactory cannot be cast to class com.github.tomakehurst.wiremock.extension.Extension (org.wiremock.grpc.GrpcExtensionFactory and com.github.tomakehurst.wiremock.extension.Extension are in unnamed module of loader 'app')
Inspecting the `GrpcExtensionFactory` class, I see that it doesn’t extend
, but instead extends
and creates
instances. Here’s where I hit a wall though, because I can’t find any documentation that explains how to run WireMock with `ExtensionFactory`s. Can someone shed some light for me?
Hi Dan, the gRPC extension uses the new classpath scanning capability so you need to make sure that a) the gRPC JAR is on the classpath, and b) don’t set the
parameter at all as this will attempt to double load the extension.
You should be able to copy what’s in here: https://github.com/wiremock/wiremock-grpc-demos/tree/main/docker