mock-server/mockserver-node

Could not find or load main class DELETE (`ClassNotFoundException`)

OliverJAsh opened this issue · 1 comments

Full reduced test case: https://github.com/OliverJAsh/mockserver-test/tree/cors

package.json:

{
  "dependencies": {
    "mockserver-node": "^5.13.2"
  }
}

main.js:

const ms = require("mockserver-node");
ms.start_mockserver({
    serverPort: 3030,
    jvmOptions: [
        "-Dmockserver.enableCORSForAPI=true",
        '-Dmockserver.corsAllowMethods="CONNECT, DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH, TRACE"',
    ].join(" "),
});
yarn
node main.js

The Node script prints this error:

Error: Could not find or load main class DELETE,
Caused by: java.lang.ClassNotFoundException: DELETE,

You need to remove the .join(" ") to make this work, as follows:

const ms = require("mockserver-node");
ms.start_mockserver({
    serverPort: 3030,
    jvmOptions: [
        "-Dmockserver.enableCORSForAPI=true",
        '-Dmockserver.corsAllowMethods="CONNECT, DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH, TRACE"',
    ],
});