tigase / tigase-xmpp-server-docker

(M) Official Docker project for Tigase XMPP Server
https://tigase.net
22 stars 5 forks source link

启动之后无法配置成功,数据库过不去,怎么初始化?不是知道创建的吗? #4

Closed HeroBarry closed 3 years ago

HeroBarry commented 3 years ago

docker run --name tigase-server -p 8080:8080 -p 5222:5222 tigase/tigase-xmpp-server:8.1.0

=====================
Could not initialize bean default (class: class tigase.db.beans.DataSourceBean$DataSourceMDConfigBean), skipping injection of this bean
RootCause:
   -> java.lang.reflect.InvocationTargetException
      [java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)]
      -> java.lang.RuntimeException: java.lang.RuntimeException: Could not initialize tigase.db.jdbc.DataRepositoryImpl for name 'default'
         [java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)]
         -> java.lang.RuntimeException: Could not initialize tigase.db.jdbc.DataRepositoryImpl for name 'default'
            [tigase.db.beans.MDPoolConfigBean.lambda$setInstances$0(MDPoolConfigBean.java:179)]
            -> tigase.db.DBInitException: Database initialization failed
               [tigase.db.jdbc.DataRepositoryImpl.initialize(DataRepositoryImpl.java:318)]
               -> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
                  [java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)]
                  -> java.net.ConnectException: Connection refused (Connection refused)
                     [java.base/java.net.PlainSocketImpl.socketConnect(Native Method)]

始终不能初始化通过
要怎么设置数据库连接?

http://localhost:8080/setup 设置的内容为:

admins = [ 'admin@e1498daba259' ]
'config-type' = 'default'
debug = [ 'server' ]
'default-virtual-host' = 'e1498daba259'
dataSource () {
    default () {
        uri = 'jdbc:mysql://localhost:3306/tigasedb?user=root&password=123456&useSSL=false&useLegacyDatetimeCode=false&allowPublicKeyRetrieval=true'
    }
}
http () {
    setup () {
        'admin-password' = '1000'
        'admin-user' = '1000'
    }
}
pubsub () {
    trusted = [ 'http@{clusterNode}' ]
}
HeroBarry commented 3 years ago

不要使用localhost*(或:127.0.0.1)

woj-tek commented 3 years ago

@HeroBarry please use English so more people can participate :-)

For people stumbling against this issue: the OP set up tigase-server in docker with database connection configured with localhost, which obviously is not provided within docker image.

Solution: use dedicated database instance (for example MySQL) and during setup provide it's hostname.