在新服务器上测试代码,java.time.localdatetime 无法转换为日期不会在生产中发生 [英] testing code on new server, java.time.localdatetime cannot be converted to date does not happen in production
问题描述
我正在使用 ColdFusion 2018 和 mariadb 10.5.4 在 AWS AMI 上设置开发服务器
I am setting up a development server on an AWS AMI with ColdFusion 2018 and mariadb 10.5.4
我不知道当前的生产版本是什么,但很有可能它们有点旧.该应用程序于 2016 年推出
I did not find out what the current production versions were but it is highly possible they were somewhat older. The application was launched in 2016
代码和生产没有变化,数据库是直接备份恢复,没有变化*当 cfoutput
查询尝试格式化字段名称:DateStamp 时,我在代码中遇到错误.这是错误代码的一个示例,它在很多地方:
The code is unchanged from production, the database is a direct backup and restore, no changes
*I am getting errors in the code in cfoutput
query when it trys to format the field Named: DateStamp. This is one example of the code that errors, it is in many places:
#DateFormat(Q.DateStamp,"m/d/yyyy")# #TimeFormat(Q.DateStamp, "short")#
这是错误
This is the error
- 值类
java.time.LocalDateTime
不能转换为日期"
- "The value class
java.time.LocalDateTime
cannot be converted to a date"
mariadb 中的表具有 DateStamp 的数据类型为 datetime,这与生产没有变化
The table in mariadb has the datatype of DateStamp as datetime, this is unchanged from production
我不知道为什么当它是常规 DateTime 时,它期望该字段是 LocalDateTime.它必须是这个环境的配置中的一些东西,但我无法理解是什么?我已经搜索过,但我得到的只是如何处理 LocalDateTime".链接类型所以没有帮助,因为当这是一个必须至少以与生产相同的代码开始的测试环境时,我无法更改所有代码
I don't know why this is expecting the field to be a LocalDateTime when it is a regular DateTime. It has to be something in the configuration of this environment but I'm having trouble understanding what? I have searched but all I get is "how to handle LocalDateTime" type of links so no help as I can't change all the code when this is a test environment that must at least start with the same code as production
推荐答案
根据我对 Adrian 贡献的评论 - 在这种情况下,通常通过比较环境之间的数据源配置来找到答案 - 最重要的是是否相同的 DB 驱动程序在两者中选择,然后是数据源上的各种高级设置,最后是数据库服务器本身的任何版本/兼容性设置.
As per my comment on Adrian's contribution - in cases like this the answer is often found by comparing the datasource configuration between environments - most importantly whether the same DB driver was chosen in both, and then the various advanced settings on the datasource, and finally any version/compatibility settings on the DB server itself.
这篇关于在新服务器上测试代码,java.time.localdatetime 无法转换为日期不会在生产中发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!