-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker JSON parsing fails on certain locales #37648
Comments
@hudaiapa88 Please re-test with a released version of Spring Boot instead of the RC1 version. If you are still having problems, please share the version of Docker Compose that you are using and a complete minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue. |
|
@hudaiapa88 Thank you for the sample. After downloading and building your sample, I can run Please run |
C:\Windows\system32>docker-compose version
|
@scottfrederick So which docker version do you recommend me to use? |
@hudaiapa88 I believe any version earlier than v2.21 will work. You might try v2.20.3. On Linux you can download a binary from the Compose plugin release page on GitHub and install it manually. I'm not sure what the process is for doing that on Windows. |
@scottfrederick I installed this version and I still get the same error. |
@hudaiapa88 I think there's still something different between your environment and the environments I'm testing on. It would be helpful if you could run these commands in your sample project and show the output:
|
@scottfrederick
|
Thanks. That JSON looks fine to me. The only explanation that I can think of is that the path in your shell differs from the path when you're running the application and, as a result, the application is using a different version of Docker Compose. You could test this theory by debugging the application with a breakpoint on |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
While this output format did change, it does not break Spring Boot's parsing of the responses as I initially thought it would. I still can't reproduce this problem with any version of Docker Compose. @hudaiapa88 Please use the suggestion Andy mentioned above and let us know what information that shows you. |
@philwebb |
It's really confusing because that Is there anything unusual about your project or setup? Have you tried with a fresh project created from start.spring.io to see if you have the same problem? Perhaps you can debug a little further up the stack and try to work out how a new If possible, can you share your project on GitHub? |
docker.zip |
Can you show us a screenshot of what |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@philwebb , Hello, I think I've found the problem, I was getting the same error as this. Appearently, spring-docker-compose uses Fasterxml.Jackson and it deserializes fields by making making all letters lowercase first, and lowercases them by using the system locale language. Because of this, ID field in the "docker -ps" response was being lowercased as ıd, not id in Turkish. I switched my operating systems language to the English and problem solved. Not a plausable solution but at least the problem is found. So, if there is a way to force jackson to use English without changing the os language, I'm happy to hear. |
@anil-ilgin Thanks a lot for that pointer. That's it indeed! This test fails: @Test
void shouldBeLocaleAgnostic() {
Locale locale = Locale.getDefault();
try {
String json = """
[{"ID":"6e415c776da188a89658ae1afc5e6f5707272559b90eadc3a01d43d95cb498e3","Name":"modulith-db-1","Image":"postgres","Command":"docker-entrypoint.sh postgres","Project":"modulith",
"Service":"db","Created":1696277752,"State":"running","Status":"Up 2 hours","Health":"","ExitCode":0,"Publishers":[{"URL":"0.0.0.0","TargetPort":5432,"PublishedPort":5432,"Protocol":"tcp"}]}]
""";
Locale.setDefault(Locale.forLanguageTag("tr-TR"));
List<DockerCliComposePsResponse> response = DockerJson.deserializeToList(json,
DockerCliComposePsResponse.class);
assertThat(response).hasSize(1);
assertThat(response.get(0).id())
.isEqualTo("6e415c776da188a89658ae1afc5e6f5707272559b90eadc3a01d43d95cb498e3");
}
finally {
Locale.setDefault(locale);
}
}
There is, and we're going to take care of that. |
I'm getting a nullPointer error because the container ids are not available. What could be the reason for this?
I use the latest version of all technologies.
The text was updated successfully, but these errors were encountered: