尝试在Windows Vista计算机上使用Environment variable DHIS2_HOME: null (TrayApp.java [main])连接启动dhis2-live.exe时出现错误Postgres

但是,如果使用H2 DB,则同一应用程序可以正常运行,但是根据要求,我需要使用Postgres

这是日志文件。

* INFO  23:48:27,232 Environment variable DHIS2_HOME: null (TrayApp.java [main])
* INFO  23:48:27,700 Initialising DHIS 2 Live... (TrayApp.java [main])
* INFO  23:48:28,574 Loading DHIS 2 on port: 8082 (WebAppServer.java [main])
* INFO  23:48:28,745 Setting DHIS 2 web app context to: /D:/dhis-live/webapps/dhis (WebAppServer.java [main])
* INFO  23:48:28,745 Lifecycle: server starting (TrayApp.java [Thread-2])
* INFO  23:48:55,001 System property dhis2.home points to /D:/dhis-live/conf (DefaultLocationManager.java [Thread-2])
* INFO  23:49:00,290 Hibernate configuration loaded, using dialect: org.hibernate.dialect.PostgreSQLDialect (DefaultHibernateConfigurationProvider.java [Thread-2])
* INFO  23:50:32,286 Found the following message senders: [org.hisp.dhis.message.EmailMessageSender@c0023f, org.hisp.dhis.sms.SmsMessageSender@b027dd] (DefaultMessageService.java [Thread-2])
* INFO  23:51:25,998 Lifecycle: server started (TrayApp.java [Thread-2])

hibernate.properties
#hibernate.dialect = org.hibernate.dialect.H2Dialect
#hibernate.connection.driver_class = org.h2.Driver
#hibernate.connection.url = jdbc:h2:./database/dhis2;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE
#hibernate.connection.username = sa
#hibernate.connection.password =

hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql:dhis2
hibernate.connection.username = dhis
hibernate.connection.password = dhis

hibernate.hbm2ddl.auto = update

最佳答案

实际上, TrayApp.java 文件将用于使用我们在 DHIS2_HOME 变量中设置的位置读取初始配置。

请按照以下步骤操作:

  • 创建一个DHIS2_HOME系统变量,其位置值类似于D:\ dhis2
  • 使用以下配置在此位置创建hibernate.properties文件
  •     hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
        hibernate.connection.driver_class = org.postgresql.Driver
        hibernate.connection.url = jdbc:postgresql:dhis2
        hibernate.connection.username = dhis
        hibernate.connection.password = dhis
        hibernate.hbm2ddl.auto = update
    

    现在单击dhis2-live.exe以使用posgresql启动dhis2应用程序。

    希望对您有帮助!!

    10-01 01:50