最近在使用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,重启,问题解决。

最新文章

  1. seL4之hello-3征途
  2. iOS 循环引用
  3. java 配置环境变量
  4. JQ判断复选框是否选中
  5. mysql忘记密码的重置方法
  6. cocos2dx游戏开发——微信打飞机学习笔记(七)——Enemy的搭建
  7. php 生成mysql数据字典代码
  8. [ES6] Converting an array-like object into an Array with Array.from()
  9. .Net程序员 Solr-5.3之旅 (三)Solr 从MSSQ导入索引数据
  10. 我被SQL注入撞了一下腰
  11. 王立平--string.Empty
  12. ORM了解
  13. MAP--复杂map结构的构造
  14. 【WPF】DispatcherFrame 是个啥玩意儿
  15. 3.如何搭建Appium自动化测试环境
  16. 2019年 Gratner数据分析平台对比 - PowerBI大幅领先
  17. django mysql 数据库配置
  18. LOJ2541 PKUWC2018 猎人杀 期望、容斥、生成函数、分治
  19. java二叉树字典查询(qq 928900200)
  20. 【转】设置Qt应用程序图标及应用程序名

热门文章

  1. python之selenium多窗口切换
  2. 【DSP开发】CCS数据格式 load
  3. 洛谷 题解 P1336 【最佳课题选择】
  4. mac必装软件
  5. 【转帖】Linux 桌面进化史
  6. [转帖] 飞腾FT2000+ CPU的进展(2019.6)
  7. Django2.2连接mysql数据库出现django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None问题
  8. 【AtCoder】ARC079
  9. Java web server 基本实现原理
  10. SpringBoot或者SpringMVC 临时取消配置的视图页面的前后缀