java.net.SocketException: Permission denied

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
via Stack Overflow by Daniil Shevelev

The solution is to run as root using sudo or to set different port in application.properties file, e.g.

server.port=${port:8181}
java.net.SocketException: Permission denied
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.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:321)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:366)
at ring.adapter.jetty$run_jetty.invokeStatic(jetty.clj:137)
at foo.server$_main.invokeStatic(server.clj:9)
at foo.server$_main.doInvoke(server.clj:7)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.Var.invoke(Var.java:375)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main$main_opt.invokeStatic(main.clj:314)
at clojure.core$apply.invokeStatic(core.clj:646)
at clojure.main$main_opt.invoke(main.clj:310)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)

Users with the same issue

Once, 1 day ago
2 times, 2 months ago
2 times, 8 months ago
10 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 3 months ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.