Metal
Metal

Reputation: 1

Caused by: java.net.ConnectException: Connection refused Cloudify CLI

I have just downloaded cloudify2.6.2. When running the CLI of the cloudify i can not run the REST API as i get this error

Starting Non-Interactive Shell
>>> connect http://$localhost:8100
http://$localhost:8100/service/testrest Rest api error: Operation failed. org.apache.http.conn.HttpHostConnectException: Connection to http://$localhost:8100 refused
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
        at org.cloudifysource.restclient.GSRestClient.executeHttpMethod(GSRestClient.java:371)
        at org.cloudifysource.restclient.GSRestClient.get(GSRestClient.java:278)
        at org.cloudifysource.restclient.GSRestClient.get(GSRestClient.java:265)
        at org.cloudifysource.shell.rest.RestAdminFacade.doConnect(RestAdminFacade.java:87)
        at org.cloudifysource.shell.AbstractAdminFacade.connect(AbstractAdminFacade.java:55)
        at org.cloudifysource.shell.commands.Connect.doExecute(Connect.java:62)
        at org.cloudifysource.shell.commands.AbstractGSCommand.execute(AbstractGSCommand.java:99)
        at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
        at org.apache.karaf.shell.console.jline.Console.run(Console.java:172)
        at org.apache.karaf.shell.console.Main.run(Main.java:191)
        at org.apache.karaf.shell.console.Main.run(Main.java:89)
        at org.cloudifysource.shell.GigaShellMain.main(GigaShellMain.java:126)
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
        ... 24 more

    Communication Error accessing http://$localhost:8100/service/testrest. Reason: Connection to http://$localhost:8100 refused

I do not have any firewall and i also use jdk7.
I need some explanation on this.

Upvotes: 0

Views: 2341

Answers (2)

Metal
Metal

Reputation: 1

There are some things to note here. First for the REST service to work it has to be up, so a bootstrapping procedure has to be done, THEN do the connect action.

In my situation it was something wrong in the setenv.sh located at ~/gigaspaces/bin/setenv.sh. There were two declarations that was not supposed to be there. One for the NIC and one for the LOOKUPLOCATOR, so i comment out them and i finally did bootstrap the cloud.

Cloudify Version 2.6.0

Danos

Upvotes: 0

Uri Cohen
Uri Cohen

Reputation: 331

Have you bootstrapped Cloudify on your machine by using bootstrap-localcloud? Also, it seems you're using $localhost instead of just localhost.

Upvotes: 2

Related Questions