You are not logged in.

#1 2015-10-09 04:16:29

baku
Member
Registered: 2015-10-09
Posts: 5

[solved] Localhost:12345 conneection refused

Hello,
Some time ago I moved from ubuntu to arch, I work as developer. I have application that during tests ( scala application ) connects to mongo.
Same code worked for me on ubuntu, and works for other ppl in my company.
Only I have issue like:

Caused by: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=localhost:12345, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException:Connection refused}}]

probably system is blocking this connection. Similar problems I have with etherpad, looks like when some application wants to connect via localhost there are some issues.
Can someone help me where to dig in ? Thanks!

I have no ouput for commands:

lsof -i tcp:12345
netstat -nat | grep :12345

here is my etc/hosts file

cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	localhost.localdomain	archbang baku
0.0.0.0         localhost.localdomain   archbang baku
::1		localhost.localdomain	localhost baku

thanks!

Offline

#2 2015-10-09 07:00:36

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [solved] Localhost:12345 conneection refused

Did you start mongodb via systemctl?  The output of lsof is saying that nothing is listening for your connection on port 12345

Offline

#3 2015-10-09 07:30:43

baku
Member
Registered: 2015-10-09
Posts: 5

Re: [solved] Localhost:12345 conneection refused

Well mongo works on port 27017, but this part of code is starting another mongo instance on this port 12345. And only on my machine it doesnt work ;/

Offline

#4 2015-10-09 07:34:42

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [solved] Localhost:12345 conneection refused

Is there no error message when it fails to start?

Offline

#5 2015-10-09 08:08:57

baku
Member
Registered: 2015-10-09
Posts: 5

Re: [solved] Localhost:12345 conneection refused

6:05:16.875 WARN  d.f.e.m.r.Mongod: sendShutdown baku/127.0.0.1:12345
java.net.ConnectException: Połączenie odrzucone
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_60]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_60]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_60]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_60]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_60]
	at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_60]
	at de.flapdoodle.embed.mongo.runtime.Mongod.sendShutdown(Mongod.java:86) ~[de.flapdoodle.embed.mongo-1.50.0.jar:na]
	at de.flapdoodle.embed.mongo.AbstractMongoProcess.sendStopToMongoInstance(AbstractMongoProcess.java:133) [de.flapdoodle.embed.mongo-1.50.0.jar:na]
	at de.flapdoodle.embed.mongo.AbstractMongoProcess.stopInternal(AbstractMongoProcess.java:107) [de.flapdoodle.embed.mongo-1.50.0.jar:na]
	at de.flapdoodle.embed.process.runtime.AbstractProcess.stop(AbstractProcess.java:170) [de.flapdoodle.embed.process-1.50.0.jar:na]
	at de.flapdoodle.embed.process.runtime.AbstractProcess$JobKiller.run(AbstractProcess.java:243) [de.flapdoodle.embed.process-1.50.0.jar:na]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

or

 Cause: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=localhost:12345, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Połączenie odrzucone}}]
[info]   at com.mongodb.BaseCluster.getServer(BaseCluster.java:82)
[info]   at com.mongodb.DBTCPConnector.getServer(DBTCPConnector.java:664)
[info]   at com.mongodb.DBTCPConnector.access$500(DBTCPConnector.java:40)
[info]   at com.mongodb.DBTCPConnector$MyPort.getConnection(DBTCPConnector.java:513)
[info]   at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:456)
[info]   at com.mongodb.DBTCPConnector.getPrimaryPort(DBTCPConnector.java:415)
[info]   at com.mongodb.DBCollectionImpl.update(DBCollectionImpl.java:265)
[info]   at com.mongodb.DBCollection.update(DBCollection.java:214)
[info]   at com.foursquare.rogue.MongoJavaDriverAdapter$$anonfun$modify$2.apply(MongoJavaDriverAdapter.scala:138)
[info]   at com.foursquare.rogue.MongoJavaDriverAdapter$$anonfun$modify$2.apply(MongoJavaDriverAdapter.scala:136)

its while running specs.
Im 100% sure that those specs are coded well, as they work for other ppl in my company ( windows users, mac users, other linux distro users ). So somehow smth is blocking it for me. Maybe its host thing ? not port.

Offline

#6 2015-10-09 09:33:55

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: [solved] Localhost:12345 conneection refused

i'm not sure but :

localhost should point to your loopback address so

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	                 localhost.localdomain	         localhost
127.0.0.1		          host_name_you_want		 baku

but i'm not sure smile, perhaps i say a stupidity


Obarun : free to control your system

Offline

#7 2015-10-09 09:35:31

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [solved] Localhost:12345 conneection refused

There's nothing in the standard build that would block you from listening on a port > 1024 as a regular user.  You can test this by installing a web server and running it on :12345.

Remember that I know *nothing* about mongodb but this stands out to me:

Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=localhost:12345, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}

To me, that reads like your code is running some kind of function called AnyServerSelector and picking localhost:12345

In your hosts file, the only reference to localhost is on the IPv6 loopback and mongo might not be IPv6 enabled.

Also, I'm not sure if the 0.0.0.0 IP is valid in your hosts file.  I think it's reserved.

Can you try hashing that 0.0.0.0 line out and in /etc/hosts and changing your code to point to 'archbang' instead of localhost?

Offline

#8 2015-10-09 09:43:55

baku
Member
Registered: 2015-10-09
Posts: 5

Re: [solved] Localhost:12345 conneection refused

well 0.0.0.0 Ive added meanwhile, just to be sure.
But when I removed it , no change

Offline

#9 2015-10-09 09:46:01

baku
Member
Registered: 2015-10-09
Posts: 5

Re: [solved] Localhost:12345 conneection refused

ok guys thanks!

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost baku
# End of file

now its ok smile

Offline

#10 2015-10-09 18:17:27

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [solved] Localhost:12345 conneection refused

baku wrote:

now its ok smile

nice... I took the liberty of editing the subject of the original post with 'solved'...  you do have the ability to modify this yourself in the future with the 'edit' button should the need arise

Offline

Board footer

Powered by FluxBB