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
最佳答案
如果您仍然感兴趣: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;
这是在战争结束后。我重新拉上拉链,然后就成功了。