Window中安装gitblit时,IP地址或端口冲突,提示Cannot assign requested address: bind的详细解决方法

时间:2024-04-09 17:07:10

【现象】

2020-10-28 17:21:18 [WARN ] FAILED [email protected]{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 [email protected]: 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端口,如下:

Window中安装gitblit时,IP地址或端口冲突,提示Cannot assign requested address: bind的详细解决方法

把81端口修改为其他端口,例如91,再启动gitblit ,即可解决。

解决方法二IP问题:在defaults.properties中找到192.168.0.8,如下:

Window中安装gitblit时,IP地址或端口冲突,提示Cannot assign requested address: bind的详细解决方法

192.168.0.8修改为正确的ip地址,再启动gitblit ,即可解决。