java lc ctype_postgresql – encoding UTF8不匹配区域设置en_US;所选的LC_CTYPE设置需要编码LATIN1...

在尝试安装OpenNMS过程中遇到错误:encoding UTF8与locale en_US不匹配,提示所需的LC_CTYPE设置需要编码LATIN1。已尝试多种PostgreSQL数据库初始化选项,包括使用UTF-8、LATIN1和en_US.UTF8编码,但问题仍未解决。当前locale设置显示所有LC_类型均为en_US。
摘要由CSDN通过智能技术生成

尝试安装opennms时:

/usr/share/opennms/bin/install -l /usr/local/lib -dis

我得到的错误:

ERROR: encoding UTF8 does not match locale en_US Detail: The chosen LC_CTYPE setting requires encoding LATIN1.

我不知道如何继续,因为我已经尝试创建DB几种不同的方式(见下文)。

完整日志:

==============================================================================

OpenNMS Installer

==============================================================================

Configures PostgreSQL tables, users, and other miscellaneous settings.

- searching for jicmp:

- trying to load /usr/local/lib/libjicmp.so: NO

- trying to load /usr/lib/jni/libjicmp.so: OK

- searching for jicmp6:

- trying to load /usr/local/lib/libjicmp6.so: NO

- trying to load /usr/lib/jni/libjicmp6.so: OK

- searching for jrrd:

- trying to load /usr/local/lib/libjrrd.so: NO

- trying to load /usr/lib/jni/libjrrd.so: NO

- trying to load /usr/lib/jni/libjrrd.so: NO

- trying to load /usr/lib/jvm/jdk1.6.0_34/jre/lib/amd64/server/libjrrd.so: NO

- trying to load /usr/lib/jvm/jdk1.6.0_34/jre/lib/amd64/libjrrd.so: NO

- trying to load /usr/lib/jvm/jdk1.6.0_34/jre/../lib/amd64/libjrrd.so: NO

- trying to load /libjrrd.so: NO

- trying to load /usr/share/opennms/lib/libjrrd.so: NO

- trying to load /usr/share/opennms/lib/linux64/libjrrd.so: NO

- trying to load /usr/java/packages/lib/amd64/libjrrd.so: NO

- trying to load /usr/lib64/libjrrd.so: NO

- trying to load /lib64/libjrrd.so: NO

- trying to load /lib/libjrrd.so: NO

- trying to load /usr/lib/libjrrd.so: NO

- trying to load /usr/lib/jni/libjrrd.so: NO

- trying to load /usr/lib/libjrrd.so: NO

- trying to load /usr/local/lib/libjrrd.so: NO

- trying to load /opt/NMSjicmp/lib/32/libjrrd.so: NO

- trying to load /opt/NMSjicmp/lib/64/libjrrd.so: NO

- trying to load /opt/NMSjicmp6/lib/32/libjrrd.so: NO

- trying to load /opt/NMSjicmp6/lib/64/libjrrd.so: NO

- Failed to load the optional jrrd library.

- This error is not fatal, since jrrd is only required for optional features.

- For more information, see http://www.opennms.org/index.php/jrrd

- using SQL directory... /usr/share/opennms/etc

- using create.sql... /usr/share/opennms/etc/create.sql

* using 'postgres' as the PostgreSQL user for OpenNMS

* using 'opennms' as the PostgreSQL database name for OpenNMS

Exception in thread "main" org.opennms.core.schema.MigrationException: an error occurred creating the OpenNMS database

at org.opennms.core.schema.Migrator.createDatabase(Migrator.java:428)

at org.opennms.core.schema.Migrator.prepareDatabase(Migrator.java:444)

at org.opennms.install.Installer.install(Installer.java:236)

at org.opennms.install.Installer.main(Installer.java:949)

Caused by: org.postgresql.util.PSQLException: ERROR: encoding UTF8 does not match locale en_US

Detail: The chosen LC_CTYPE setting requires encoding LATIN1.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:366)

at org.opennms.core.schema.Migrator.createDatabase(Migrator.java:425)

... 3 more

数据库列表:

Name | Owner | Encoding | Collate | Ctype | Access privileges

-----------+----------+----------+---------+-------+-----------------------

postgres | postgres | LATIN1 | en_US | en_US |

rhq | rhqadmin | LATIN1 | en_US | en_US |

template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +

| | | | | postgres=CTc/postgres

template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +

| | | | | postgres=CTc/postgres

(4 rows)

我使用了以下3个initdb选项,但没有一个工作

/usr/local/pgsql/bin/initdb -E UTF-8 --pgdata=/usr/local/pgsql/data

/usr/local/pgsql/bin/initdb -E LATIN1 --pgdata=/usr/local/pgsql/data

/usr/local/pgsql/bin/initdb -E en_US.UTF8 --pgdata=/usr/local/pgsql/data

另外,在使用initdb之前,我需要删除/usr/local/pgsql / data中的所有数据吗?

追加区域设置命令stdout:

$ locale

LANG=en_US

LANGUAGE=en_US:

LC_CTYPE="en_US"

LC_NUMERIC="en_US"

LC_TIME="en_US"

LC_COLLATE="en_US"

LC_MONETARY="en_US"

LC_MESSAGES="en_US"

LC_PAPER="en_US"

LC_NAME="en_US"

LC_ADDRESS="en_US"

LC_TELEPHONE="en_US"

LC_MEASUREMENT="en_US"

LC_IDENTIFICATION="en_US"

LC_ALL=

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值