java.net.SocketException: 权限不够
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: 权限不够的更多相关文章
- Linux下报 java.net.SocketException权限不够 异常解决
转载自:http://wangchongan.com/articles/java-net-socket-exception-permission-denied.html 今天在Linux下用Jetty ...
- 解决: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 ...
- android程序在调试时出现了套接字异常“java.net.SocketException: Permission denied”该如何解决
Socket不能对外连接,错误不会被报出,调试的时候,能看到Exception, 一般是抛出 java.net.socketexception permission denied这个异常.只要你的程序 ...
- Protocol handler start failedCaused by: java.net.SocketException: Permission denied
最近在使用mac启动项目的时候,发现原本在Windows下正常跑的项目报错如下: Protocol handler start failedCaused by: java.net.SocketExce ...
- 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) ...
- java.net.SocketException: Connection reset
java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java ...
- 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 ...
- 安装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 ...
- java.net.SocketException: Software caused connection abort: socket write error
用Java客户端程序访问Java Web服务器时出错: java.net.SocketException: Software caused connection abort: socket write ...
随机推荐
- shell 处理小数位加减法(比较)运算
有一个shell脚本需要处理小数位运算,刚开始使用了expr Java代码 a=7.9 b=10 c=`expr $a \> $b` 结果运算错误,因为expr只支持整数运算,不支持小数. ...
- UOJ#450. 【集训队作业2018】复读机 排列组合 生成函数 单位根反演
原文链接https://www.cnblogs.com/zhouzhendong/p/UOJ450.html 题解 首先有一个东西叫做“单位根反演”,它在 FFT 的时候用到过: $$\frac 1 ...
- Saltstack 集中化管理平台安装
Saltstack的简介 SaltStack(http://www.saltstack.com/)是一个服务器基础架构集中化管理平台,具备配置管理.远程执行.监控等功能,一般可以理解为简化版的pupp ...
- HDU 2204 Eddy's 爱好 (容斥原理)
<题目链接> 题目大意: Ignatius 喜欢收集蝴蝶标本和邮票,但是Eddy的爱好很特别,他对数字比较感兴趣,他曾经一度沉迷于素数,而现在他对于一些新的特殊数比较有兴趣. 这些特殊数是 ...
- linux环境下安装tcping工具测试访问超时
wget https://sources.voidlinux.eu/tcping-1.3.5/tcping-1.3.5.tar.gz tar zxvf tcping-1.3.5.tar.gz cd t ...
- 解决Spring boot中读取属性配置文件出现中文乱码的问题
问题描述: 在配置文件application.properties中写了 server.port=8081 server.servlet.context-path=/boy name=张三 age=2 ...
- C#代码总结03---通过获取类型,分类对前台页面的控件进行赋值操作
该方法: 一般用于将数据库中的基本信息字段显示到前台页面对应的字段控件中 private void InitViewZc(XxEntity model) { foreach (var info in ...
- UIImagePickerController照片选取器
记录于2013/7/4 加入框架: MobileCoreServices.framework MediaPlayer.framework 导入头文件: #import <MediaP ...
- 1.3 正则表达式和Python语言-1.3.5使用 search()在一个字符串中查找模式(搜索与匹配 的对比)
1.3.5 使用 search()在一个字符串中查找模式(搜索与匹配的对比) 其实,想要搜索的模式出现在一个字符串中间部分的概率,远大于出现在字符串起始部分的概率.这也就是 search()派上用场的 ...
- 【C语言编程练习】7.2动态数列排列
1. 题目要求 编写这样一个C程序,实现这样的功能:从键盘输入任意个整数,以0作为结束标志,对于这个整数序列从小到大排序,并输出排序后结果 2. 题目分析 不得不说,我确实对这类问题毫无思路呢!应该也 ...