服务无法启动

莫语 7月前 298

这边单独部署了IM服务器,但是启动不起来,数据库所在服务器3306端口已开启访问,但是报这个错


            _  _      _   __  _                    _             _   
 __      __(_)| |  __| | / _|(_) _ __  ___    ___ | |__    __ _ | |_ 
 \ \ /\ / /| || | / _` || |_ | || '__|/ _ \  / __|| '_ \  / _` || __|
  \ V  V / | || || (_| ||  _|| || |  |  __/ | (__ | | | || (_| || |_ 
   \_/\_/  |_||_| \__,_||_|  |_||_|   \___|  \___||_| |_| \__,_| \__|

com.mysql.cj.jdbc.exceptions.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.
        at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:829)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:449)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:242)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at win.liyufan.im.DBUtil.init(DBUtil.java:97)
        at io.moquette.server.Server.startServer(Server.java:234)
        at io.moquette.server.Server.startServer(Server.java:226)
        at io.moquette.server.Server.startServer(Server.java:210)
        at io.moquette.server.Server.start(Server.java:120)
        at cn.wildfirechat.server.Server.main(Server.java:15)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: 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.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
        at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
        at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
        at com.mysql.cj.NativeSession.connect(NativeSession.java:120)
        at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:949)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:819)
        ... 11 more
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
        at java.net.Socket.connect(Socket.java:606)
        at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:156)
        at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
        ... 14 more
最新回复 (1)
  • HeavyRain 7月前
    引用 2
    从日志看是不能连接到数据库,
    1,请检查 c3p0.xml中配置的mysql信息是否正确,
    2,mysql跟IM服务是分开的吗,如果是分开的,mysql默认关闭外网访问,需要打开。
    3,可以在IM所在的服务器上安装mysql客户端,用mysql客户端连接配置中的mysql地址,看看是否能够连上
返回