从 wildfly 访问 postgresql 时出现编码错误
encoding error accessing postgresql from wildfly
刚刚设置新计算机,我无法让我的 wildfly 连接到 postgres。我使用与旧计算机相同的 standalone.xml。
postgres 数据库配置为 UTF8(默认)。 Usign pgadmin,我从备份中恢复,它正确显示德语 Umlaute。
但是当我启动 wildfly 时,出现以下错误:
Caused by: java.io.IOException: Ung³ltige UTF-8-Sequenz: das erste Byte ist 10xxxxxx: 187
at org.postgresql.core.UTF8Encoding.decode(UTF8Encoding.java:104)
at org.postgresql.core.PGStream.ReceiveString(PGStream.java:331)
at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:705)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
... 35 more
抱歉出现德语错误消息。我不知道为什么这条消息是德语的。
有什么想法是错误的吗?
事实证明,解析不同区域设置的错误消息存在问题。显然 postgresql jdbc 驱动程序只能处理英文错误消息并且出现错误。
根本原因:我在数据库中拼错了 table。这导致 Postgresql 抛出错误。但它抛出了一个德语错误信息的错误。并且 postgresql jdbc 驱动程序无法解析它并抛出一个新错误,如问题所示。
我修复了最初的拼写错误,根本原因消失了,没有更多的错误消息需要解析。
一年后(现在)我终于通过编辑 standalone.xml:
解决了语言环境问题
<datasource jndi-name="java:jboss/datasources/PostgresDS" ...>
...
<new-connection-sql>SET lc_messages TO 'en_US.UTF-8'</new-connection-sql>
...
</datasource>
刚刚设置新计算机,我无法让我的 wildfly 连接到 postgres。我使用与旧计算机相同的 standalone.xml。 postgres 数据库配置为 UTF8(默认)。 Usign pgadmin,我从备份中恢复,它正确显示德语 Umlaute。 但是当我启动 wildfly 时,出现以下错误:
Caused by: java.io.IOException: Ung³ltige UTF-8-Sequenz: das erste Byte ist 10xxxxxx: 187
at org.postgresql.core.UTF8Encoding.decode(UTF8Encoding.java:104)
at org.postgresql.core.PGStream.ReceiveString(PGStream.java:331)
at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:705)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
... 35 more
抱歉出现德语错误消息。我不知道为什么这条消息是德语的。
有什么想法是错误的吗?
事实证明,解析不同区域设置的错误消息存在问题。显然 postgresql jdbc 驱动程序只能处理英文错误消息并且出现错误。
根本原因:我在数据库中拼错了 table。这导致 Postgresql 抛出错误。但它抛出了一个德语错误信息的错误。并且 postgresql jdbc 驱动程序无法解析它并抛出一个新错误,如问题所示。
我修复了最初的拼写错误,根本原因消失了,没有更多的错误消息需要解析。
一年后(现在)我终于通过编辑 standalone.xml:
解决了语言环境问题<datasource jndi-name="java:jboss/datasources/PostgresDS" ...>
...
<new-connection-sql>SET lc_messages TO 'en_US.UTF-8'</new-connection-sql>
...
</datasource>