reagent-project / reagent-template

A Leiningen template for projects using Reagent.
MIT License
394 stars 55 forks source link

"java.net.BindException: Address already in use" #79

Closed vak closed 8 years ago

vak commented 8 years ago

on my Ubuntu 15.04 box i've created a dummy project reagent_try using

lein new reagent reagent_try

then did a cd reagent_try and finally:

reagent_try$ lein figwheel
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Figwheel: Starting server at http://localhost:3449
Focusing on build ids: app
Compiling "resources/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]...
Successfully compiled "resources/public/js/app.js" in 0.194 seconds.
Started Figwheel autobuilder
java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
    at java.net.ServerSocket.bind(ServerSocket.java:376)
    at java.net.ServerSocket.bind(ServerSocket.java:330)
    at clojure.tools.nrepl.server$start_server.doInvoke(server.clj:143)
    at clojure.lang.RestFn.invoke(RestFn.java:512)
    at figwheel_sidecar.repl$start_nrepl_server.invoke(repl.clj:524)
    at figwheel_sidecar.repl$run_autobuilder.invoke(repl.clj:550)
    at user$eval16376.invoke(form-init5817032352215769635.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6782)
    at clojure.lang.Compiler.eval(Compiler.java:6772)
    at clojure.lang.Compiler.load(Compiler.java:7227)
    at clojure.lang.Compiler.loadFile(Compiler.java:7165)
    at clojure.main$load_script.invoke(main.clj:275)
    at clojure.main$init_opt.invoke(main.clj:280)
    at clojure.main$initialize.invoke(main.clj:308)
    at clojure.main$null_opt.invoke(main.clj:343)
    at clojure.main$main.doInvoke(main.clj:421)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Subprocess failed

netstat -nap |grep 3449 shows no process bound to this port

yogthos commented 8 years ago

Could it be some firewalling issue perhaps, that could cause the port bind to fail.

sergium commented 8 years ago

just checked - works well (OSX 10.10.5 + java version "1.8.0_45")

vak commented 8 years ago

it is hardly a firewall issue, my ufw service is inactive. And

sudo iptables -L INPUT --line-numbers

has an empty output, that is no blocking rules

vak commented 8 years ago

a deeper look shows, that there is also a nrepl-port, which was indeed already bound on my box:

:server-port 3449 :nrepl-port 7002

I've changed it and it works now.

yogthos commented 8 years ago

Ah so looks like the log is a bit misleading, it binds 3449 successfully, but then fails to bind nrepl and it's not obvious at all. :)

vak commented 8 years ago

yep) P.S. also, you may want to add smth like "change directory to project you've just created" before "lein figwheel" in README.md for the newbies like me ;)

yogthos commented 8 years ago

good call :+1: