java.net.SocketException: 权限不够

一切问题的根源都是缺乏常识  0.0.....
背景:今天部署一个spring cloud服务,tanainaide 服务的端口为80,然后我建了个tomcat用户来启动,但是死活起不来,搞了好久还以为是环境问题都重新建了台新机子,还是不行,然后换root用户起来可以,很奇怪。报错如下:

12-12 19:44:58.792|INFO|c.netflix.discovery.DiscoveryClient:813|DiscoveryClient-InstanceInfoReplicator-0||DiscoveryClient_TPP-ZUUL-PRE/10.90.6.95:80 - registration status: 204
12-12 19:44:58.795|INFO|o.s.b.a.e.jmx.EndpointMBeanExporter:678|main||Located managed bean 'configurationPropertiesReportEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=configurationPropertiesReportEndpoint]
12-12 19:44:58.797|INFO|o.s.c.s.DefaultLifecycleProcessor:343|main||Starting beans in phase 2147483647
12-12 19:44:58.801|INFO|o.s.c.n.h.HystrixCircuitBreakerConfiguration$HystrixMetricsPollerConfiguration:138|main||Starting poller
12-12 19:44:58.816|INFO|o.s.s.a.ScheduledAnnotationBeanPostProcessor:262|main||No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
12-12 19:44:58.825|INFO|o.a.coyote.http11.Http11NioProtocol:179|main||Initializing ProtocolHandler ["http-nio-80"]
12-12 19:44:58.836|INFO|o.a.coyote.http11.Http11NioProtocol:179|main||Starting ProtocolHandler ["http-nio-80"]
12-12 19:44:58.839|ERROR|o.a.coyote.http11.Http11NioProtocol:181|main||Failed to start end point associated with ProtocolHandler ["http-nio-80"]
java.net.SocketException: 权限不够
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:990)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:635)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1022)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:250)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:193)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at com.pci.tpp.gateway.GatewayApplication.main(GatewayApplication.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
12-12 19:44:58.840|ERROR|o.a.catalina.core.StandardService:181|main||Failed to start connector [Connector[HTTP/1.1-80]]
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-80]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:250)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:193)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at com.pci.tpp.gateway.GatewayApplication.main(GatewayApplication.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1031)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 19 common frames omitted
Caused by: java.net.SocketException: 权限不够
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:990)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:635)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1022)
... 20 common frames omitted
12-12 19:44:58.847|INFO|o.a.coyote.http11.Http11NioProtocol:179|main||Pausing ProtocolHandler ["http-nio-80"]
12-12 19:44:58.848|INFO|o.a.catalina.core.StandardService:179|main||Stopping service [Tomcat]
12-12 19:44:58.852|WARN|o.a.c.loader.WebappClassLoaderBase:179|localhost-startStop-1||The web application [ROOT] appears to have started a thread named [spring.cloud.inetutils] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
12-12 19:44:58.855|INFO|o.apache.catalina.util.LifecycleBase:179|main||The stop() method was called on component [StandardServer[-1]] after stop() had already been called. The second call will be ignored.
12-12 19:44:58.855|INFO|o.a.coyote.http11.Http11NioProtocol:179|main||Stopping ProtocolHandler ["http-nio-80"]
12-12 19:44:58.855|INFO|o.a.coyote.http11.Http11NioProtocol:179|main||Destroying ProtocolHandler ["http-nio-80"]
12-12 19:44:58.857|INFO|o.s.b.a.l.AutoConfigurationReportLoggingInitializer:101|main|| Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
12-12 19:44:58.860|ERROR|o.s.b.d.LoggingFailureAnalysisReporter:42|main||

原因其实是因为在linux下,如果使用1024以下的端口则需要root权限,所以因为我当前使用的不是root权限,所以权限不足而无法使用80端口,所以会报权限不够异常。把服务端口改为非80端口且大于1024的端口,比如8080即可。
在配置文件中修改端口号。

java.net.SocketException: 权限不够的更多相关文章

  1. Linux下报 java.net.SocketException权限不够 异常解决

    转载自:http://wangchongan.com/articles/java-net-socket-exception-permission-denied.html 今天在Linux下用Jetty ...

  2. 解决:IDEA unable to import maven project see logs for details问题+java http请求报java.net.SocketException: Permission denied:connect 问题

    背景:用IDEA写了一个java发送http请求的maven项目. 运行时,项目报java.net.SocketException: Permission denied:connect问题: 修改po ...

  3. android程序在调试时出现了套接字异常“java.net.SocketException: Permission denied”该如何解决

    Socket不能对外连接,错误不会被报出,调试的时候,能看到Exception, 一般是抛出 java.net.socketexception permission denied这个异常.只要你的程序 ...

  4. Protocol handler start failedCaused by: java.net.SocketException: Permission denied

    最近在使用mac启动项目的时候,发现原本在Windows下正常跑的项目报错如下: Protocol handler start failedCaused by: java.net.SocketExce ...

  5. Unable to open debugger port (127.0.0.1:55119): java.net.SocketException "Socket closed"

    1.端口问题 排查端口,lsof -i:8080 修改端口等 2.权限问题 端口排查无解的话,查看idea Event Log(View->Tool Window->Event Log) ...

  6. java.net.SocketException: Connection reset

    java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java ...

  7. IntelliJ运行下载的Servlet时报错 Error running Tomcat 8.5.8: Unable to open debugger port (127.0.0.1:49551): java.net.SocketException

    学习Java Servlet时,从Wrox上下载了示例代码,准备run/debug时发现以下错误: Error running Tomcat 8.5.8: Unable to open debugge ...

  8. 安装Java的IDE Eclipse时出现java.net.SocketException,出现错误Installer failed,show.log

    ERROR: org.eclipse.equinox.p2.transport.ecf code=1002 Unable to read repository at http://download.e ...

  9. java.net.SocketException: Software caused connection abort: socket write error

    用Java客户端程序访问Java Web服务器时出错: java.net.SocketException: Software caused connection abort: socket write ...

随机推荐

  1. Invitation Cards spfa

    题意  n个点m条单向边   计算 从1到每一个点的权值(除了1) 和每个点回到1 的权值之和 正向跑一次 反向跑一次即可 #include<bits/stdc++.h> using na ...

  2. ISP PIPLINE (十) HDR

    在讲HDR之前先理解一些概念,要知道为什么进行HDR? 再去想如何进行HDR. 自然界的中光强度很宽,而人眼对高亮,极暗环境的细节分辨能力比较弱.而摄像头记录的范围更窄,真正的HDR技术就是记录视觉范 ...

  3. Linux多核并行编程关键技术

    多核并行编程的背景 在摩尔定律失效之前,提升处理器性能通过主频提升.硬件超线程等技术就能满足应用需要.随着主频提升慢慢接近撞上光速这道墙,摩尔定律开始逐渐失效,多核集成为处理器性能提升的主流手段.现在 ...

  4. go 结构体

    结构体声明 type Employee struct { ID int Name string Address string DoB time.Time Position string Salary ...

  5. 继承ipkPlayer中出现的一些错误汇总

    1.下载完ffmpeg后,我们再在终端执行下面两个命令: cd ios./compile-ffmpeg.sh clean./compile-ffmpeg.sh all 大体流程如下  这里如果出现 x ...

  6. JS中[object object]怎么取值

    错误信息:本来是要显示JSON对象的  结果控制台打印了[object object] 需要做一个简单的转换,如下: var jsonData = JSON.stringify(data);// 转成 ...

  7. C语言实型常量

    实型常量又称实数或浮点数.在C语言中可以用两种形式来表示一个实型常量. 一.小数形式 小数形式的实型常量由两部分组成:数字和小数点.如:0.12.12...12都是合法的实型常量. 二.指数形式 在C ...

  8. React组件和生命周期简介

        React 简介----React 是 Facebook 出品的一套颠覆式的前端开发类库.为什么说它是颠覆式的呢? 内存维护虚拟 DOM 对于传统的 DOM 维护,我们的步骤可能是:1.初始化 ...

  9. pycahrm 安装Vue项目

    首先在pycharm > preference > plugins > vue > 点绿色install 创建一个文件夹 然后cmd里cd到这个文件夹 npm install ...

  10. Java语法细节 - synchronized和volatile

    目录 synchronized关键字 关键字volatile synchronized关键字 synchronized关键字锁住方法和this的不同之处: public synchronized vo ...