Could someone please assist me in resolving this i...
# general
v
Could someone please assist me in resolving this issue? I am attempting to run the Docker command by incorporating an extension, following the guidelines provided at: - WireMock Docker documentation: https://wiremock.org/docs/standalone/docker/#running-with-extensions - Extension repository: https://github.com/wiremock/wiremock-state-extension I have placed the extension JAR file in the "extensions" folder on my local machine, and verified the presence of the extension's classname within the JAR (please refer to the attached screenshot). Here is the Docker command I used:
docker run -it --rm -p 8080:8080 --name wiremock -v $PWD/extensions:/var/wiremock/extensions wiremock/wiremock --extensions org.wiremock.extensions.state.extensions.RecordStateEventListener
However, I encountered the following error:
Exception in thread "main" java.lang.ClassNotFoundException: org.wiremock.extensions.state.extensions.RecordStateEventListener
d
You shouldn't register the parts of this extension individually - you should register the whole extension. The extension uses the
ServiceLoader
extension, thus it should be auto detected when it's on the classpath (which should be the case if I interpret your cmdline correctly). Can you start wiremock without
--extensions ...
and with
--verbose
? The detected extensions should be printed out. see also: https://github.com/wiremock/wiremock-state-extension#docker
v
@Dirk Bolte ok. but i could not find the extension listed after start:
i do not see the jar in the location inside docker container
d
The cmdline and directory structure looks ok. As you have a snapshot jar I assume that you built the extension yourself. Can you try the following commands in the upmost directory of the repository checkout?
Copy code
./gradlew clean
./gradlew shadowjar
run -it --rm -p 8080:8080 --name wiremock -v $PWD/build/libs:/var/wiremock/extensions wiremock/wiremock -- --global-response-templating --verbose
Locally, I see the extension registered properly:
v
many thanks. let me try