When I just do lein repl it works, but when I try to connect to a host I get a refusing to connect error.
Connecting to nREPL at 127.0.0.1:7000
ConnectException Connection refused (Connection refused)
java.net.PlainSocketImpl.socketConnect (PlainSocketImpl.java:-2)
java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:400)
java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:243)
java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:225)
java.net.SocksSocketImpl.connect (SocksSocketImpl.java:402)
java.net.Socket.connect (Socket.java:591)
java.net.Socket.connect (Socket.java:540)
java.net.Socket.<init> (Socket.java:436)
java.net.Socket.<init> (Socket.java:213)
clojure.tools.nrepl/connect (nrepl.clj:184)
clojure.tools.nrepl/connect (nrepl.clj:174)
clojure.core/apply (core.clj:646)
Bye for now!
I have tried messing with my /etc/hosts:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
But changing it did not help.
Settings:
MacOS 10.13.2
Leiningen 2.8.1 on Java 9.0.1 Java HotSpot(TM) 64-Bit Server VM
Running lein repl will start its own nREPL and connect to that. Specifying :connect 7000 won't start a REPL—it expects one to already be running on that port.
$ lein repl
nREPL server started on port 57535 on host 127.0.0.1 - nrepl://127.0.0.1:57535
REPL-y 0.3.7, nREPL 0.2.12
In a separate session you should be able to connect to your other/running REPL:
$ lein repl :connect 57535
Connecting to nREPL at 127.0.0.1:57535
REPL-y 0.3.7, nREPL 0.2.12
Related
Starting repl using:
lein repl :headless :port 4242
When I try to connect VIA cider connect I get the following error:
Connection closed unexpectedly (connection broken by remote peer)
When I try to connect VIA:
lein repl :connect 4242
I get the following error:
SocketException The transport's socket appears to have lost its connection to the nREPL server
clojure.tools.nrepl.transport/bencode/fn--5154/fn--5155 (transport.clj:95)
clojure.tools.nrepl.transport/bencode/fn--5154 (transport.clj:95)
clojure.tools.nrepl.transport/fn-transport/fn--5126 (transport.clj:42)
clojure.core/binding-conveyor-fn/fn--4676 (core.clj:1938)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
java.lang.Thread.run (Thread.java:748)
Bye for now!
By default nrepl listens for connections only from the same computer. It does this by "binding" its listener to the IP address of the loopback network 127.0.0.1. If you want it to listen for connections from anywhere you can either bind it to 0.0.0.0 which is the any network address, or the address of a specific adapter.
It looks like I needed to specify the host as 0.0.0.0 e.g.
lein repl :headless :host 0.0.0.0 :port 4242
In the following link
http://clojure.org/reference/repl_and_main#_launching_a_socket_server
it has detailed info about how to start socket REPL form java, but since I am using lein, so how to start from lein. If start from boot is good to run, I could also try to use boot.
To start a socket repl, you need to pass this option to the JVM
-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"
In Leiningen, add this to your project.clj.
:jvm-opts ["-Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl}"] ; notice that the map is not quoted.
and in Boot, export the environment variable BOOT_JVM_OPTIONS
export BOOT_JVM_OPTIONS='-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"'
Once your REPL is running, you can run telnet from a different terminal to connect to the socket REPL. REPLception!
$ telnet 127.0.0.1 5555
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
user=> (+ 1 1)
2
user=>
boot has an upcoming socket-server task. As of boot 2.7.1, a version that includes this task hasn't been released yet.
In the meantime you can use the following commands to launch Socket REPLs. To launch a Clojure process with a Socket REPL listening on port 50505 using boot, use:
boot -i "(do (require 'clojure.core.server) (clojure.core.server/start-server {:port 50505 :name :repl :accept 'clojure.core.server/repl}))" wait
Using Leiningen:
JVM_OPTS='-Dclojure.server.myrepl={:port,50505,:accept,clojure.core.server/repl}' lein repl
Using a pain Clojure jar:
java -Dclojure.server.myrepl="{:port 50505 :accept clojure.core.server/repl}" -jar ~/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar
I'm trying to connect to an nREPL from a Docker container that is running another, linked Docker container on port 7888. Despite exposing the port with -p 7888, linking the container with -link <first_container_name>:repl and using the Docker-injected environment host and port variables, I am getting a "Connection refused." error.
Here's how I run the first container:
docker run -i -t -p 7888 clojure-image lein repl :headless :port 7888
~$ nREPL server started on port 55555 on host 127.0.0.1
And the second container:
docker run -i -t -link <first_container_name>:repl clojure-image /bin/bash
username#hostname~$ lein repl :connect 172.0.2.1:7888
Why is my connection being refused? I am able to connect other services like AMQP between Docker containers.
You have to include :host 0.0.0.0 in the lein repl command to allow connections on a hostname/address other than 127.0.0.1:
lein repl :headless :host 0.0.0.0 :port 7888
You can include the port number as follows:
lein repl :headless :port 1234
If you are running on a Mac, you are probably behind boot2docker, so this article helped, a lot. Here is how I connected to the container:
lein repl :connect $(boot2docker ip):7888
And thanks to: What IP do I access when using docker and boot2docker?
Hi I'm learning django form kenneth love's GSWD video tutorials.
I'm using windows 7(32bit) and have vagrant and virtual box installed in it. The OS in virtual machine is Ubuntu 12.04 LTS
As asked in the tutorial I did the following
**vagrant#precise32:/vagrant/projects$ source ~/blog.venv/bin/activate
Installed Django
then created project with django-admin.py startproject microblog
(blog.venv)vagrant#precise32:/vagrant/projects$ cd microblog
(blog.venv)vagrant#precise32:/vagrant/projects/microblog$ python
manage.py runserver 0.0.
0.0:8000
Validating models... 0 errors found Django version 1.4.4, using
settings 'microblog.settings' Development server is running at
(http removed)//0.0.0.0:8000/ Quit the server with CONTROL-C.**
After this when I go back to windows 7 browser and run 127.0.0.1:8888 as said in tutorial I get "can't establish a connection to the server at 127.0.0.1:8888" error.
What should I do to get the default "It Worked"-django page ???
Did you change the Vagrantfile to do port forwardings?
For example, in your case, host port 8888 <=> guest port 8000
Vagrant.configure("2") do |config|
config.vm.network :forwarded_port, guest: 8000, host: 8080
end
Refer to the docs: http://docs.vagrantup.com/v2/networking/forwarded_ports.html
i just installed pgadmin iii and try to connect server.
I configured my setting
name:localhost
host: 127.0.0.1
port:5432
username:postgres
but i always get this error
The server doesn't accept connection: the connection library reports
**could not connect to server : Connection refused Is server runing on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
However, i'm runing django and python on 127.0.0.1 What's missing?
There's also a problem with mysql. I could not connect with them
If you change the pg_hba.conf file to accept connections (for example: "host all all 127.0.0.1 255.255.255.0 trust") it should work
Installing postgre v12 before uninstalling v11 I found the config file (postgresql.conf) had a line "port = 5433". Changing this to "port = 5432" fixed the issue for me.