1

OpenNMS - PostgreSQL/Java 数据库问题

我知道 jicmp 文件不会导致致命错误,但是当 OpenNMS 去创建用户时,似乎有一个 Java 异常。

有经验的人知道是什么原因造成的吗?

从 OpenNMS 安装程序转储的错误

- using SQL directory... C:\Program Files\OpenNMS\etc
- using create.sql... C:\Program Files\OpenNMS\etc\create.sql
* using 'postgres' as the PostgreSQL user for OpenNMS
* using 'opennms' as the PostgreSQL database name for OpenNMS
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.opennms.bootstrap.Bootstrap$4.run(Bootstrap.java:460)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.opennms.core.schema.MigrationException: an error occurred creating the OpenNMS user
    at org.opennms.core.schema.Migrator.createUser(Migrator.java:339)
    at org.opennms.core.schema.Migrator.prepareDatabase(Migrator.java:447)
    at org.opennms.install.Installer.install(Installer.java:254)
    at org.opennms.install.Installer.main(Installer.java:989)
    ... 6 more
Caused by: org.postgresql.util.PSQLException: ERROR: unrecognized role option "createuser"
  Position: 54
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:321)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:313)
    at org.opennms.core.schema.Migrator.createUser(Migrator.java:337)
    ... 9 more
4

1 回答 1

0

如果您仍然感兴趣:postgres 数据库已更改CREATE USER命令。该参数CREATEUSER不再有效,应更改为CREATEROLE。这应该create.sql在它尝试创建用户的文件中完成。

我有一个类似的 OpenCMS 案例,opencms\setup\database\postgresql\create_db.sql在我改变的地方:

#
# replacer = "${database}"
############################

# Create the user;

CREATE USER ${user}
  PASSWORD '${password}'
  CREATEDB CREATEUSER;

#create the database

CREATE DATABASE ${database}
  WITH ENCODING='UNICODE' OWNER=${user};

#commit all (if connection is not autocommit)
commit;

为了

#
# replacer = "${database}"
############################

# Create the user;

CREATE USER ${user}
  PASSWORD '${password}'
  CREATEDB CREATEROLE;

#create the database

CREATE DATABASE ${database}
  WITH ENCODING='UNICODE' OWNER=${user};

#commit all (if connection is not autocommit)
commit;

这是解压缩战争之后。我重新压缩了它,然后它工作了。

于 2018-03-02T09:15:47.723 回答