最近把操作系统迁移到了deepin,不得不说Linux中需要学习的还是有很多的,本地启动网关的时候就遇到一个坑,特此记录一下,报错信息。

Caused by: reactor.netty.ChannelBindException: Failed to bind on [0.0.0.0:188]
	Suppressed: java.lang.Exception: #block terminated with an error
		at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:133) ~[reactor-core-3.2.19.RELEASE.jar:3.2.19.RELEASE]
		at reactor.core.publisher.Mono.block(Mono.java:1531) ~[reactor-core-3.2.19.RELEASE.jar:3.2.19.RELEASE]
		at reactor.netty.http.server.HttpServer.bindNow(HttpServer.java:128) ~[reactor-netty-0.8.20.RELEASE.jar:0.8.20.RELEASE]
		at reactor.netty.http.server.HttpServer.bindNow(HttpServer.java:111) ~[reactor-netty-0.8.20.RELEASE.jar:0.8.20.RELEASE]
		at org.springframework.boot.web.embedded.netty.NettyWebServer.startHttpServer(NettyWebServer.java:102) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.embedded.netty.NettyWebServer.start(NettyWebServer.java:73) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext$ServerManager.start(ReactiveWebServerApplicationContext.java:223) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.startReactiveWebServer(ReactiveWebServerApplicationContext.java:124) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.finishRefresh(ReactiveWebServerApplicationContext.java:116) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.1.17.RELEASE.jar:5.1.17.RELEASE]
		at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.1.16.RELEASE.jar:2.1.16.RELEASE]
		at org.muyuan.core.launch.MuyuanApplication.run(MuyuanApplication.java:35) [muyuan-core-launch-2.6.0.RELEASE.jar:na]
		at org.muyuan.gateway.GateWayApplication.main(GateWayApplication.java:18) [classes/:na]
Caused by: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: 权限不够

注意关键信息bind 188端口提示,权限不够。原来是Linux下1024以下的端口需要sudo,通过修改端口就可以正常启动了。

或者这样来授权你的可执行路径

setcap cap_net_bind_service=+eip /home/tengine/nginx/tengine/sbin/nginx

清除授权

setcap -r nginx
Logo

更多推荐