英文:
UncategorizedMongoDbException: unrecognized time zone identifier
问题
自从今天开始,在运行测试时我们遇到了一个非常奇怪的错误,我们无法找到错误持续存在的原因。
2020-08-21 15:13:35,035 [ERROR] [] org.mongodb.driver.client: Callback onResult call produced an error
4961
com.mongodb.MongoException: org.springframework.data.mongodb.UncategorizedMongoDbException: 命令失败,错误码为40485(Location40485):'unrecognized time zone identifier: "BST"',位于服务器localhost:27017。完整响应如下:{"ok": 0.0, "errmsg": "unrecognized time zone identifier: \"BST\"", "code": 40485, "codeName": "Location40485"};嵌套异常为com.mongodb.MongoCommandException:命令失败,错误码为40485(Location40485):'unrecognized time zone identifier: "BST"',位于服务器localhost:27017。完整响应如下:{"ok": 0.0, "errmsg": "unrecognized time zone identifier: \"BST\"", "code": 40485, "codeName": "Location40485"}
最重要的是未对失败的测试进行任何代码更改
,因此我们猜测根本原因可能在某个全局配置中,但我们难以理解该配置是什么。
非常感谢任何帮助或提示!
英文:
Since today we started to encounter a very strange error during running tests, and we could not find the reason why does the error persist.
2020-08-21 15:13:35,035 [ERROR] [] org.mongodb.driver.client: Callback onResult call produced an error
4961
com.mongodb.MongoException: org.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 40485 (Location40485): 'unrecognized time zone identifier: "BST"' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "unrecognized time zone identifier: \"BST\"", "code": 40485, "codeName": "Location40485"}; nested exception is com.mongodb.MongoCommandException: Command failed with error 40485 (Location40485): 'unrecognized time zone identifier: "BST"' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "unrecognized time zone identifier: \"BST\"", "code": 40485, "codeName": "Location40485"}
The most important thing is that no code changes were done to the failed test
, so our guess is that the root cause is somewhere in one of the global configurations, but we challenge to understand what is that configuration.
Any help or hint would be highly appreciated.
Thanks!
答案1
得分: 1
问题出在 maven-surefire-plugin
中的 systemPropertyVariables
的 user.timozone
上。将它改为 UTC
,甚至删除它都可以解决这个问题。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkCount>1</forkCount>
<useSystemClassLoader>false</useSystemClassLoader>
<systemPropertyVariables>
<user.timezone>UTC</user.timezone>
</systemPropertyVariables>
</configuration>
</plugin>
英文:
The issue was with systemPropertyVariables
user.timozone
in maven-surefire-plugin
. Changing it to UTC
or even deleting it fixed the issue.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkCount>1</forkCount>
<useSystemClassLoader>false</useSystemClassLoader>
<systemPropertyVariables>
<user.timezone>BTS</user.timezone>
</systemPropertyVariables>
</configuration>
</plugin>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论