OpenNMS - PostgreSQL/Java 数据库问题
我知道 jicmp 文件不会导致 fatal error ,但是当 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
最佳答案
如果您仍然感兴趣:postgres 数据库已经更改了CREATE USER
命令。参数 CREATEUSER
不再有效,应更改为 CREATEROLE
。这应该在尝试创建用户的 create.sql
文件中完成。
我在 opencms\setup\database\postgresql\create_db.sql
中有一个类似的 OpenCMS 案例,我在其中更改了:
#
# 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;
这是在解压缩 war 之后。我重新压缩了它,然后就可以使用了。
关于java - Windows OpenNMS - PostgreSQL/Java 数据库问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39977311/