java - Windows OpenNMS - PostgreSQL/Java 数据库问题

标签 java windows postgresql opennms

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/

相关文章:

java - 如何在java中获取httpResponse的一部分

java - 匿名类是否总是保持对其封闭实例的引用?

java - 在 Spring Security 中排除通过过滤器传递的身份验证

ruby-on-rails - 如何将 activerecord-sqlserver-adapter 与 TinyTDS *和* Windows 上的集成安全连接一起使用 *无需*以纯文本形式保存密码

windows - 获取屏幕分辨率作为cmd中的变量

Postgresql 在尝试使用音量时引发 'data directory has wrong ownership'

java - Jface 树中的工具提示

windows - 如何从命令提示符编译多种语言?

mysql - 在 PostgreSQL 中使用嵌套查询进行更新,但出现不需要的结果

django - docker-compose 不启动 postgres