在新服务器上测试代码,java.time.localdatetime无法转换为生产中未发生的日期 [英] testing code on new server, java.time.localdatetime cannot be converted to date does not happen in production

查看:94
本文介绍了在新服务器上测试代码,java.time.localdatetime无法转换为生产中未发生的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 我正在使用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

代码在生产中未更改,数据库是直接备份和还原,没有更改*当我尝试格式化名为"DateStamp"的字段时,在 cfoutput 查询中的代码中出现错误.这是一个出错的代码示例,在很多地方:

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作为日期时间,这与生产环境相同

    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的贡献的评论-在这种情况下,通常可以通过比较环境之间的数据源配置来找到答案-最重要的是,是否使用相同的数据库驱动程序两者都选择,然后选择数据源上的各种高级设置,最后选择数据库服务器本身上的任何版本/兼容性设置.

    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屋!

  • 查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆