Hi everyone! I am trying to start wiremock extensi...
# help
s
Hi everyone! I am trying to start wiremock extension using docker. I created the class and I added CMD ["--extensions", "com.m.extensions.ResponseTransformExtension"] to my .dockerfile, but I keep getting "java.lang.ClassNotFoundException when running." I also tried putting the whole path name with ./src/main... but I got the same error. Do I need to do something else to register the extension?
o
Hi. Are you passing
.class
.
.jar
or just a source file?
s
just source file
o
It won't work. Java files need to be compiled and preferably packaged as jar files
s
So for example if I want to compile your wiremock-extensions, I created a jar from the project and downloaded that jar to my working directory. Then in my dockerfile I added that jar to /var/wiremock/extensions/ in docker, and I can see that it worked. However, CMD ["--extensions", "ExtensionClassName"] is not recognizing the extension class still. I'm not seeing the class in my jar, so is there an issue with how I created the jar?
o
If there is no class in the Jar file, then yes the problem is with the file you created. My recommendation is creating a simple Maven or Gradle project so that a standard packaging is followed. I could create a template repository or a Maven archetype after my vacation, I would appreciate if you could create a GitHub issue in the WireMock/community repo
Normally we could also jump on a call but I will be parenting until the next week, and for the next 2 days I am without the laptop.