开发者

Error in starting labrepl with Clojure in Eclipse Helios

I'm having some difficulty starting what I presume is the webserver for the labrepl program.

I used the instructions here to set everything up, and installed labrepl successfully.

I was able to run the repl and get the lessons in my browser. For some reason, when I started Eclipse today and used the "Run As new Clojure project's JVM and a REPL" it said there was an error in the labrepl.clj. I cleared out the directory made by git (I couldn't find the one made by Maven, but I deleted it out of the workspace, specifying to delete the files).

I went through the directions on that website again, getting what seems like labrepl 0.0.2 (according to the pom.xml file). Now there were no problems with the labrepl.clj, but when starting (labrepl/-main), the following error comes up:

2011-04-17 01:29:07.380:INFO::jetty-6.1.26
2011-04-17 01:29:07.502:WARN::failed SocketConnector@0.0.0.0:9000: java.net.BindException:     
Address already in use: JVM_Bind
2011-04-17 01:29:07.503:WARN::failed Server@2d68be1b: java.net.BindException: Address  
already in use: JVM_Bind
java.net.BindException: Address already in use: JVM_Bind (repl-1:3)

Consequently, the web based version of the lessons will 开发者_如何转开发not work. I hunted through the directory structure for the lessons, but I couldn't find any html.

I found this which seems to be a similar problem, possible solution for rolling back to an earlier version, but I wanted to see if anyone had run into this specific situation before.


The problem you link to is not similar: you've already solved the problem he was having, so there's no need to worry about trying to apply his solution. Instead, your issue is that some other program is using socket 8080, so the labrepl webserver can't.

Last time I used Eclipse, it turned out that Eclipse itself optionally uses 8080 for some kind of dynamic-language support and that was getting in my way; but 8080 is a pretty common port, and someone else might be using it.

If you are using a Unix-like operating system, there's one way you can find out who has that socket open - use lsof to list "open files" with the -i option to say that you mean sockets.

$ lsof -i :8080
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    6427  akm   46u  IPv6 107739      0t0  TCP *:http-alt (LISTEN)

$ cat /proc/6427/cmdline 
java-cplib/*:src/:resourceclojure.main-e(use 'sexpbot.run) (-main)

The command line is a bit mangled, but recognizable: process 6427 is listening to my port 8080, and that process is my local copy of sexpbot.

If you have such a process, you can work around your problem by disabling it temporarily (say, by killing the process).

The better long-term solution is to configure Jetty to use a different port for labrepl. I'm sure there are better ways of doing this, but I don't know Jetty that well. If you look inside labrepl/src/labrepl.clj, there is a line (run-jetty (var app) {:port 8080. Change 8080 to some other port (say, 8778), and then it should start up fine. You'll be able to browse to localhost:8778 and work with labrepl that way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜