-
Notifications
You must be signed in to change notification settings - Fork 42
unable to start body-transformer with wiremock-standalone-2.1.12.jar #19
Comments
I was having the same issue with 1.1.1. I ended up downloading 1.1.2 and building, then using the latest release of WireMock. It starts up when I run this: java -classpath 'wiremock-body-transformer-1.1.2.jar:wiremock-standalone-2.3.1.jar' com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --verbose --extensions com.opentable.extension.BodyTransformer Hope that helps - I'm new to Java though so maybe I did extra work for nothing. |
thanks Stormwing that worked for me btw have you used the transformer with requests generated in proxy mode? |
Nope - that I have not yet done, sorry. I wish you the best of luck though. On Fri, Nov 11, 2016 at 9:53 AM, gearoid rogers notifications@github.com
|
Thanks @Stormwing for helping figure out the issue. @gearoidr I haven't used the proxy mode yet. Is it working for you? |
@tranhungt yes, i've managed to get it working in proxy mode, it records mapping files and responses but it's not clear to me how to apply the body transformer to the mapping and response files as the response file is returned in this format { so if I wanted the start and end dates to dynamically match any POST request received and update the dates in the file body-7000026011-order-8rkM3.json, i'm not entirely sure how to get that to work using the transformer |
@gearoidr can you copy us what's in your body-7000026011-order-8rkM3.json file?
|
@tranhungt - so the request body of the POST would look like { and then the content of body-7000026011-order-8rkM3.json would look like { so if I wanted the request fields sent in the POST body, startDate, endDate, bedget and addressId etc to dynamically change in the response based on those values, how can I configure both the mapping and response files to do that? |
@gearoidr
And your request mapping can look like this - I removed the bodyPatterns constraint so you can get it working, so it will map the request based on the URL and http method only, but if you need your mappings to selective map based on certain request body fields, then you can add them back in.
|
@tranhungt - thanks again for your input, I tried what you suggested, and while the request mapping was found - it didn't do any transformation on the fields in the response. Matched response definition: Response: { |
@gearoidr What was your full request? |
Hi , |
I am trying to start the transformer with wiremock standalone in proxy mode using the following command -
java -cp "wiremock-body-transformer-1.1.1.jar:wiremock-standalone-2.1.12.jar:./lib/*" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --proxy-all="http://proxy.com" --port=8090 --record-mappings --verbose --extensions com.opentable.extension.BodyTransformer
but am getting the following error
Exception in thread "main" java.lang.ClassNotFoundException: com.opentable.extension.BodyTransformer
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader$3.apply(ExtensionLoader.java:75)
at com.github.tomakehurst.wiremock.extension.ExtensionLoader$3.apply(ExtensionLoader.java:71)
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.extension.ExtensionLoader.load(ExtensionLoader.java:39)
at com.github.tomakehurst.wiremock.standalone.CommandLineOptions.extensionsOfType(CommandLineOptions.java:263)
at com.github.tomakehurst.wiremock.WireMockServer.(WireMockServer.java:84)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:65)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.main(WireMockServerRunner.java:113)
any suggestions on how to resolve this please?
The text was updated successfully, but these errors were encountered: