最近在使用mac启动项目的时候,发现原本在Windows下正常跑的项目报错如下:

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

一模一样的代码,Windows下正常运行,但在mac上面却报错了,实在让人不解,所以这篇文章记录下解决的方案。


查找原因

经过Google发现,stackflow上面已经有大牛回答了这个问题,直接贴过来看看

Linux doesn't allow a normal user to bind to a TCP port that's <= 1024. There's a discussion of the reasons for that here. You're attempting to bind to 86 and, therefore, it's failing with "Permission denied". The quickest and safest solution is to configure the port with a value that's > 1024.

As you're using Boot's embedded Tomcat instance, the port's configured in application.propertiesusing the server.port property.

翻译过来就是说:

Linux不允许普通用户绑定到<= 1024 \的TCP端口。 有一个讨论原因[这里](https://unix.stackexchange.com/questions/16564/why-are-the-first-1024-ports-restricted-to-the-root-user-only)。 你试图绑定到80,因此它失败了“权限被拒绝”。 最快和最安全的解决方案是使用大于1024的值配置端口。当您使用Boot的嵌入式Tomcat实例时,使用server.port属性在application.properties中配置端口。

总结

好了,原因找到了,原来在linux下,为了系统安全,使用小于1024端口时,需要被授权,最快的解决方案就是更换一个大于1024的端口。ok,直接把端口号更改为8080,重启,问题解决。

Protocol handler start failedCaused by: java.net.SocketException: Permission denied的更多相关文章

  1. tomcat报错:java.net.SocketException: Permission denied["http-nio-80"]

    tomcat报错:java.net.SocketException: Permission denied["http-nio-80"] 问题:使用非root账户tomcat启动to ...

  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. Android出现java.net.SocketException: Permission denied报错

    是由于权限问题导致的,在manifests中找到AndroidManifest.xml 在manifest节点下新增 <uses-permission android:name="an ...

  5. 安卓开发中遇到java.net.SocketException: Permission denied

    仅需在AndroidManifest.xml添加 <uses-permission android:name="android.permission.INTERNET" /& ...

  6. JMeter学习-017-java.net.SocketException: Permission denied: connect 解决方案

    前几天,有了新的接口性能测试需求,同事在添加 HTTP请求 后,运行时响应信息如下所示: java.net.SocketException: Permission denied: connect at ...

  7. gerrit集成gitweb:Error injecting constructor, java.io.IOException: Permission denied

    使用gerrit账户在centos上安装gerrit,然后集成gitweb,gerrit服务启动失败,查看日志,报错信息如下: [-- ::,] ERROR com.google.gerrit.pgm ...

  8. 【解决】hbase regionserver意外关机启动失败 [main] mortbay.log: tmpdir java.io.IOException: Permission denied

    错误信息: 015-12-24 10:57:26,527 INFO  [main] mortbay.log: jetty-6.1.26.cloudera.4 2015-12-24 10:57:26,5 ...

  9. kafka启动时出现FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) java.io.IOException: Permission denied错误解决办法(图文详解)

    首先,说明,我kafk的server.properties是 kafka的server.properties配置文件参考示范(图文详解)(多种方式) 问题详情 然后,我启动时,出现如下 [hadoop ...

随机推荐

  1. 为什么要设置 Mysql 的 ft_min_word_len=1

    为什么要设置 Mysql 的 ft_min_word_len=1 ? 从 Mysql 4.0 开始就支持全文索引功能,但是 Mysql 默认的最小索引长度是 4.如果是英文默认值是比较合理的,但是中文 ...

  2. 【FICO系列】SAP FI验证故障排除(调试)

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[FICO系列]SAP FI验证故障排除(调试) ...

  3. 如何下载spring sts

    1.打开https://spring.io/ 2.翻到页面最底部点击tools 3.页面下滑点击Download STS4 Windows 64-bit

  4. axios二次封装的几种方法

    一.用Class方法 import axios from "axios"; declare var Promise: any; export class Request { sta ...

  5. ubuntu/debian将sh改为bash

    1.  查看现在环境 可以看到,现在的默认环境是sh.我们想把它变为bash,可以这样做: 2. 运行sudo dpkg-reconfigure dash,出现以下画面: 这里提示我们是否要用默认的s ...

  6. 【Funny Things】002——鞋的颜色

    网上的那张鞋子的图片到底是什么颜色的?灰绿色还是粉色? 1. 先截取图片中鞋的那块的图片,获取大小 2. 带入大小分别计算R,G,B平均值 3. 通过计算所得的数据画图可得结果 from PIL im ...

  7. hdu4813 01背包+前缀和

    题意:\(A,B\)两人,有\(N\)个事件,每件发生的概率都为\(0.5\),若事件\(i\)发生,则\(B\)加\(v_i\)分数,若其不发生,则\(B\)不加分,给定一个概率\(P\),问至少需 ...

  8. not or and 的优先级是不同的

    not or and 的优先级是不同的: not > and > or 请用最快速度说出答案: not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 an ...

  9. 关于DB2的使用(DB2数据命令)

           公司所用的数据库有金仓和DB2 首先要用命令窗口直接打开db2需要在cmd中输入:db2cmd 1:启动DB2数据库:db2start 2:连接数据库:db2 connect to  数 ...

  10. hdu 2609 字符串最小表示法 虽然不是很懂 还是先贴上来吧。/,。/

    还需要再消化一下这个算法.. 今天没有时间了,, 六级过了 就有大把时间 快活啊!#include<iostream> #include<cstdio> #include< ...