Closed maojunxyz closed 2 years ago
dockerfiles-mockServer-1 | 2022-03-02 10:34:03 5.12.0 SEVERE exception creating persisted expectations file mockserverInitialization.json
dockerfiles-mockServer-1 | java.nio.file.AccessDeniedException: mockserverInitialization.json
dockerfiles-mockServer-1 | at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
dockerfiles-mockServer-1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
dockerfiles-mockServer-1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
dockerfiles-mockServer-1 | at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
dockerfiles-mockServer-1 | at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
dockerfiles-mockServer-1 | at java.base/java.nio.file.Files.createFile(Files.java:648)
dockerfiles-mockServer-1 | at org.mockserver.persistence.ExpectationFileSystemPersistence.
My docker compose file
version: "2.4" services: mockServer: image: mockserver/mockserver:mockserver-5.12.0 command: -logLevel DEBUG -serverPort 1090 -proxyRemotePort 80 -proxyRemoteHost www.mock-server.com ports:
Same trouble here. I mapped a a config directory to the /config folder in the container, enabled expectations persistence and defined the path, as seen below.
volumes:
- ./config:/config
environment:
MOCKSERVER_LOG_LEVEL: INFO
MOCKSERVER_PERSIST_EXPECTATIONS: "true"
MOCKSERVER_PERSISTED_EXPECTATIONS_PATH: /config/modified expectations.json
This throws the following exception (permissions):
mock-server_1 | 2022-03-18 14:15:13 5.13.0 SEVERE exception creating persisted expectations file /config/modified expectations.json
mock-server_1 | java.nio.file.AccessDeniedException: /config/modified expectations.json
mock-server_1 | at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
mock-server_1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
mock-server_1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
mock-server_1 | at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
mock-server_1 | at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
mock-server_1 | at java.base/java.nio.file.Files.createFile(Files.java:648)
mock-server_1 | at org.mockserver.persistence.ExpectationFileSystemPersistence.<init>(ExpectationFileSystemPersistence.java:49)
mock-server_1 | at org.mockserver.mock.HttpState.<init>(HttpState.java:122)
mock-server_1 | at org.mockserver.lifecycle.LifeCycle.<init>(LifeCycle.java:55)
mock-server_1 | at org.mockserver.netty.MockServer.<init>(MockServer.java:77)
mock-server_1 | at org.mockserver.netty.MockServer.<init>(MockServer.java:48)
mock-server_1 | at org.mockserver.cli.Main.main(Main.java:145)
I have also created the specified file in the folder with touch
but the problem persists.
Same trouble here. I mapped a a config directory to the /config folder in the container, enabled expectations persistence and defined the path, as seen below.
volumes: - ./config:/config environment: MOCKSERVER_LOG_LEVEL: INFO MOCKSERVER_PERSIST_EXPECTATIONS: "true" MOCKSERVER_PERSISTED_EXPECTATIONS_PATH: /config/modified expectations.json
This throws the following exception (permissions):
mock-server_1 | 2022-03-18 14:15:13 5.13.0 SEVERE exception creating persisted expectations file /config/modified expectations.json mock-server_1 | java.nio.file.AccessDeniedException: /config/modified expectations.json mock-server_1 | at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) mock-server_1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) mock-server_1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) mock-server_1 | at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219) mock-server_1 | at java.base/java.nio.file.Files.newByteChannel(Files.java:371) mock-server_1 | at java.base/java.nio.file.Files.createFile(Files.java:648) mock-server_1 | at org.mockserver.persistence.ExpectationFileSystemPersistence.<init>(ExpectationFileSystemPersistence.java:49) mock-server_1 | at org.mockserver.mock.HttpState.<init>(HttpState.java:122) mock-server_1 | at org.mockserver.lifecycle.LifeCycle.<init>(LifeCycle.java:55) mock-server_1 | at org.mockserver.netty.MockServer.<init>(MockServer.java:77) mock-server_1 | at org.mockserver.netty.MockServer.<init>(MockServer.java:48) mock-server_1 | at org.mockserver.cli.Main.main(Main.java:145)
I have also created the specified file in the folder with
touch
but the problem persists.
I think the problem here is the file name, which contains a space (/config/modified expectations.json). Change it to /config/modified_expectations.json.
Describe the issue When watchInitializationJson is enabled, updating expectations through expectation ID will clear all expectations
What you are trying to do
MockServer version 5.11.2
To Reproduce Steps to reproduce the issue:
How you are running MockServer (i.e maven plugin, docker, etc) maven dependency
Code you used to create expectations
Expected behaviour Concurrent updating expectations through same expectation ID,Just updat By Id.
MockServer Log
In addition, I saw the demo shows that the stand-alone configuration is somewhat different from the cluster configuration. Clustering MockServer open
watchInitializationJson=true
, Won't the above problems occur in the cluster environment?Clustering MockServer