Window中安裝gitblit時,IP地址或埠衝突,提示Cannot assign requested address: bind的詳細解決方法

秋9發表於2020-11-01

【現象】

2020-10-28 17:21:18 [WARN ] FAILED ServerConnector@68154893{HTTP/1.1}{192.168.0.8:81}: java.net.BindException: Cannot assign requested address: bind
java.net.BindException: Cannot assign requested address: bind
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:444)
        at sun.nio.ch.Net.bind(Net.java:436)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:321)
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.server.Server.doStart(Server.java:366)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at com.gitblit.GitBlitServer.start(GitBlitServer.java:460)
        at com.gitblit.GitBlitServer.main(GitBlitServer.java:124)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.moxie.MxLauncher.main(MxLauncher.java:129)
2020-10-28 17:21:18 [WARN ] FAILED org.eclipse.jetty.server.Server@236a56f1: java.net.BindException: Cannot assign requested address: bind
java.net.BindException: Cannot assign requested address: bind
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:444)
        at sun.nio.ch.Net.bind(Net.java:436)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)

【原因分析】

Cannot assign requested address: bind說明埠衝突,即81埠被佔用,需要修改一下埠。

【解決方法】

找到git配置檔案(我的git檔案為C:\work\git\gitblit-1.8.0\data\defaults.properties)。

解決方法一埠問題:在defaults.properties中找到81埠,如下:

把81埠修改為其他埠,例如91,再啟動gitblit ,即可解決。

解決方法二IP問題:在defaults.properties中找到192.168.0.8,如下:

192.168.0.8修改為正確的ip地址,再啟動gitblit ,即可解決。

 

 

相關文章