Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect - java

I'm very new in spring boot and trying to build a microservices project using spring boot by referring to tutorial but i'm getting this error. While try to retrieve localhost:8888 i got this "localhost refused to connect". I already try to change server port but still get the same outcome. Please help me.Why did i get this connection refuse? FYI: i try to connect my spring cloud config server to git.

i too has the same issue
i had two spring boot application - LS and SCCS
the port used for LS is 8080
the port used for SCCS is 8888
i tried to pass all the configuration of LS to SCCS and tried to run the LS ....I got the connection timeout error...
instead...
u run the SCCS first.. which is configured in 8888... it works fine
hope this answers your question

Related

Why can't my docker container app communicate with container couchbase database?

So I have a clone of the java application, and an active couchbase database, everything on my local machine. When I run the java spring application, everything works well, the application will connect to the database.
On the other hand, I use the same project and database configurations using docker containers. But I can't seem to make them communicate, and when the app starts, I keep getting this exception:
java.net.ConnectException: Connection refused: localhost/127.0.0.1:8091
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:223)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:285)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:589)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:513)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:427)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:399)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
I also created a docker network where I put the app and database.
Any idea why there is no connectivity ?
you try to connect to container's localhost
java.net.ConnectException: Connection refused:
localhost/127.0.0.1:8091
But you need to connect to another container. If you run docker container with argument --link mysql:mysql you need to specify into app configuration file connect to mysql instead of localhost of 127.0.0.1

Java RMI - Lookup Success , but method call fails - Onpremise Vs AWS

I have a java code which makes connection to a Java RMI server - lookup followed by method invocation.
Both machine are under the same firewall in onpremise and works as expected.
When my client/java moved to AWS, the RMI server is still running in on-premise.. But here in this case, it fails with below error..
Lookup success, method call failed..
Lookup for Remote Object Successful.
ErrorMessage:startupFunction : RemoteException Caught.. Connection refused to host: XXXXX ; nested exception is:
java.net.ConnectException: Connection timed out
PS : I see similiar issue in this post, but nothing seems to work in my case
You need to export your remote object on a fixed port, and open that port in your firewall.
Fixed this by adding the port used by RMI Method.. We ran the request from on-premise and in the RMI host we ran netstat and captured the port list.. This way we could figure out the port and enabled in Security group in AWS.. thanks all for your help..

Connecting to couchbase running on alternate ports using java client

I'm using couchbase-client 2.3.2 for Java and Couchbase server Community 4.0
So I'm experimenting with running Couchbase on non-standard ports using the documentation at Couchbase website
I've managed to start Couchbase using these alternate ports but I've only managed to change some of the ports in the java client, here's my code:
final CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.bootstrapCarrierDirectPort(21210)
.bootstrapHttpDirectPort(9091)
.build();
return CouchbaseCluster.create(env, "10.0.2.15");
My program is able to connect to couchbase and so some things, however I still need to change the view port (default 8092) and the query port (default 8093) in the client. as a result I'm met with these errors:
2016-09-30 14:03:49.696 [] WARN c.c.c.c.e.Endpoint - [null][QueryEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8093
2016-09-30 14:03:52.077 [] WARN c.c.c.c.e.Endpoint - [null][ViewEndpoint]: Could not connect to endpoint, retrying with delay 2048 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8092
So the client still tries to connect to 8092 and 8093 when in fact I've changed those to 9092 and 9093
From the JavaDoc on 2.3.4 (http://docs.couchbase.com/sdk-api/couchbase-java-client-2.3.4/), I believe what you want is this:
DefaultCouchbaseEnvironment.Builder viewEndpoints(int viewServiceEndpoints)
Even though it's completely undocumented, you need to add those ports to static_config as well:
{capi_port, 9092}.
{query_port, 9093}.
and then it works, hope someone at couchbase sees this and updates their documentation :)

Eclipse Tomcat Depolyer plug in error

I downloaded Tomcat Deployer
so i could deploy remotely to my tomcat server, when insert all the correct details it ask for such as:
Manager URL
Username/Password
URL of sync App
when i try to deploy i keep getting this error:
Failed to deploy: com.caucho.hessian.client.HessianRuntimeException: java.net.ConnectException: Connection refused: connect
Projecct [HFJSe] deploy completed.
And nothing is deployed.
If there anything i need to do on my Tomcat server?
The error states that the target machine is refusing the connection, so you'll need to check the following information:
The URL is correct (I know you've stated it, but the URL should be in the format of http://{host}:{port}/TomcatHelper (from what I understand in the documentation)
That if there is a configuation file, that the port is configured appropriately
The target server has that port open to accepting connections
Your username and password is correct
If your "remote" server is on the same local machine, use your loopback address (i.e. localhost

JavaDB wont start on App start, giving me a java.sql.SQLNonTransientConnectionException:

java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
Error connecting to server localhost on port 1527 with message Connection refused: connect.
I am using Netbeans.
If I go to the Services Tab and rightclick Java DB and start Server it works fine.
How can I do this programmaticly at Runtime. I just need whatever method will start the Java DB Server.
Have a look at how to use JavaDB with a desktop application. They describe how to start it programmatically there.
You need to start the NetworkServerControl additional documentation can be found here
NetworkServerControl server = new NetworkServerControl(InetAddress.getByName("localhost"), port);

Categories

Resources