【Linux部署】第一次部署ZooKeeper启动两次报错问题解决 Could not find or load main class+Failed to bind to /0.0.0.0:8080
生活随笔
收集整理的這篇文章主要介紹了
【Linux部署】第一次部署ZooKeeper启动两次报错问题解决 Could not find or load main class+Failed to bind to /0.0.0.0:8080
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
使用 zkServer.sh start-foreground 啟動可以看到報錯信息,使用的時候還是用 zkServer.sh start 來啟動服務。
1.第一次安裝報錯
安裝包(apache-zookeeper-3.6.0.tar.gz)啟動報錯如下:
[root@aliyun conf]# zkServer.sh start-foreground ZooKeeper JMX enabled by default Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.server.quorum.QuorumPeerMain類直接找不到,最近我把JDK從8換成了11,想著會不會是因為JDK的原因,上網查詢了一下才知道,不帶-bin的安裝包是源碼包,需要編譯才能使用,沒文化多可怕。
2.第二次安裝報錯
這次使用了已編譯的安裝包(apache-zookeeper-3.6.0-bin.tar.gz)啟動報錯如下:
2021-06-25 14:08:20,222 [myid:] - ERROR [main:ZooKeeperServerMain@79] - Unable to start AdminServer, exiting abnormally org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commandsat org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:107)at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:138)at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:106)at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:128)at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82) Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080真是命運多舛,之前安裝zookeeper時沒有遇到問題,當時應該是(用了編譯后的包且8080端口未被占用),之前真的是憑運氣上車的 😃
3.問題解決
這個就很明白了,端口被占用,換端口就能解決問題:修改zoo.cfg文件,添加admin.serverPort=8088。再次啟動,成功:
[root@aliyun ~]# jps 17669 QuorumPeerMain總結
以上是生活随笔為你收集整理的【Linux部署】第一次部署ZooKeeper启动两次报错问题解决 Could not find or load main class+Failed to bind to /0.0.0.0:8080的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring定时任务注解@Schedul
- 下一篇: 程序员学习网站备份(小众+不定时更新in