no class found exception when runnning from standalone #1
Comments
Thanks for reporting this. I may be able to work on it next week. I'll keep you posted. |
@nyaw I updated the extension to be used straight on the command line via jar. Download the wiremock-body-transformer-1.0.2.jar file and use as so:
|
@tranhungt when I tried running your suggestions with the updated jar received Error: Could not find or load main class com.github.tomakehurst.wiremock.standalone.WireMockServerRunner |
@nyaw , did you download the wiremock standalone server as well? |
The wiremock standalone jar can be downloaded here. http://wiremock.org/running-standalone.html |
yes running standalone works without any issues. When trying to run with the transformer extensions is the one I'm still struggling |
That error says it cannot find the WireMockServerRunner. Are you running the command within the directory where the standalone and extension jars are? You should first be able to run this command to ensure that you can start up the wiremock standalone server. And then this command to include the extension on the server startup. |
here's the output from my command line and confirmed all jars are in the same directory C:\Apps>java -cp "wiremock-1.57-standalone.jar" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner port: 8080 C:\Apps>java -cp "wiremock-body-transformer-1.0.2.jar:wiremock-1.57-standalone.jar" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --verbose --extensions com.opentable.extension.BodyT |
That's really strange... that exact command works for me. Can you run with |
Are you on windows machine? Multiple classpaths uses the |
Yup on windows this is what I have tried C:\Apps>java -cp "./*" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --verbose --extensions com.opentable.extension.BodyTransformer C:\Apps>java -cp "wiremock-body-transformer-1.0.2.jar;wiremock-1.57-standalone.jar" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --verbose --extensions com.opentable.extension.Body |
Nice catch. The wiremock dependency is out of date. I'll update it. |
@nyaw, |
What java version are you using? If not java 8, it's best to upgrade to get all the benefits of the new version. Java 8 runtime is compatible with all prior versions of compiled java code. |
yea installed jdk 1.8 on my machine and now able to start the standalone with the extensions. But if you could look at how to overcome running it on jdk 1.7 or below will be good as nearly all of the machines in our jenkins boxes are still on 1.7 |
@nyaw , we got the fix in place to support 1.7, but can't deploy it yet until the the parent pom gets updated. |
Unless we have further feedback to support 1.7, we'll close this this ticket and continue to support only 1.8 and onwards. |
C:\Users\IdeaProjects\wiremock |
Run from command line java -jar wiremock-1.57-standalone.jar -verbose -extensions com.opentable.extension.BodyTransformer
Exception in thread "main" java.lang.ClassNotFoundException: com.opentable.extension.BodyTransformer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader$3.apply(ExtensionLoader.java:76)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader$3.apply(ExtensionLoader.java:72)
at wiremock.com.google.common.collect.Iterators$8.transform(Iterators.java:799)
at wiremock.com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at wiremock.com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at wiremock.com.google.common.collect.Maps.uniqueIndex(Maps.java:1163)
at wiremock.com.google.common.collect.Maps.uniqueIndex(Maps.java:1140)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader.asMap(ExtensionLoader.java:43)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader.loadExtension(ExtensionLoader.java:32)
at com.github.tomakehurst.wiremock.standalone.CommandLineOptions.extensionsOfType(CommandLineOptions.java:237)
at com.github.tomakehurst.wiremock.WireMockServer.(WireMockServer.java:85)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:62)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.main(WireMockServerRunner.java:110)
The text was updated successfully, but these errors were encountered: