https://linen.dev logo
#help
Title
# help
s

Sejal Madan

07/24/2023, 2:36 PM
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

Oleg Nenashev

07/24/2023, 3:54 PM
Hi. Are you passing
.class
.
.jar
or just a source file?
s

Sejal Madan

07/24/2023, 4:10 PM
just source file
o

Oleg Nenashev

07/24/2023, 4:35 PM
It won't work. Java files need to be compiled and preferably packaged as jar files
s

Sejal Madan

07/25/2023, 5:08 PM
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

Oleg Nenashev

07/26/2023, 7:36 AM
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.