Connection refused to host: localhost











up vote
0
down vote

favorite












java.rmi.ConnectException: Connection refused to host: localhost; 
nested exception is:
java.net.ConnectException: Connection refused: connect


Server code:



TaxService taxService = new TaxService();
Registry registry = LocateRegistry.createRegistry(8889);
registry.bind("TaxService", taxService);
System.out.println("The server started");


Client code:



Registry registry = null;
try {
registry = LocateRegistry.getRegistry("localhost", 8889);
} catch (RemoteException e1) {
e1.printStackTrace();
}
ITaxService taxService = null;
try {
taxService = (ITaxService) registry.lookup("TaxService");
} catch (RemoteException e) {
System.out.println(e);
}









share|improve this question
























  • Did you run the RMI registry?
    – Henry
    Nov 10 at 18:26










  • Henry, Firstly I executed the server side and it worked and after that when I tried to executed the client side I got this error message. The error came from this line registry = LocateRegistry.getRegistry("localhost", 8889);
    – Luiza
    Nov 10 at 20:49












  • (1) Are you installing the RMISecurityManager? If yes, you may need to tweak the securlty policy to allow connections to localhost:8889 ... (2) After you start the server, assuming it stays up and running, can you open a second terminal and telnet to localhost 8889 ? If yes, the server is there, so it's a client issue; if no, then it's a server issue ...
    – moilejter
    Nov 11 at 23:36















up vote
0
down vote

favorite












java.rmi.ConnectException: Connection refused to host: localhost; 
nested exception is:
java.net.ConnectException: Connection refused: connect


Server code:



TaxService taxService = new TaxService();
Registry registry = LocateRegistry.createRegistry(8889);
registry.bind("TaxService", taxService);
System.out.println("The server started");


Client code:



Registry registry = null;
try {
registry = LocateRegistry.getRegistry("localhost", 8889);
} catch (RemoteException e1) {
e1.printStackTrace();
}
ITaxService taxService = null;
try {
taxService = (ITaxService) registry.lookup("TaxService");
} catch (RemoteException e) {
System.out.println(e);
}









share|improve this question
























  • Did you run the RMI registry?
    – Henry
    Nov 10 at 18:26










  • Henry, Firstly I executed the server side and it worked and after that when I tried to executed the client side I got this error message. The error came from this line registry = LocateRegistry.getRegistry("localhost", 8889);
    – Luiza
    Nov 10 at 20:49












  • (1) Are you installing the RMISecurityManager? If yes, you may need to tweak the securlty policy to allow connections to localhost:8889 ... (2) After you start the server, assuming it stays up and running, can you open a second terminal and telnet to localhost 8889 ? If yes, the server is there, so it's a client issue; if no, then it's a server issue ...
    – moilejter
    Nov 11 at 23:36













up vote
0
down vote

favorite









up vote
0
down vote

favorite











java.rmi.ConnectException: Connection refused to host: localhost; 
nested exception is:
java.net.ConnectException: Connection refused: connect


Server code:



TaxService taxService = new TaxService();
Registry registry = LocateRegistry.createRegistry(8889);
registry.bind("TaxService", taxService);
System.out.println("The server started");


Client code:



Registry registry = null;
try {
registry = LocateRegistry.getRegistry("localhost", 8889);
} catch (RemoteException e1) {
e1.printStackTrace();
}
ITaxService taxService = null;
try {
taxService = (ITaxService) registry.lookup("TaxService");
} catch (RemoteException e) {
System.out.println(e);
}









share|improve this question















java.rmi.ConnectException: Connection refused to host: localhost; 
nested exception is:
java.net.ConnectException: Connection refused: connect


Server code:



TaxService taxService = new TaxService();
Registry registry = LocateRegistry.createRegistry(8889);
registry.bind("TaxService", taxService);
System.out.println("The server started");


Client code:



Registry registry = null;
try {
registry = LocateRegistry.getRegistry("localhost", 8889);
} catch (RemoteException e1) {
e1.printStackTrace();
}
ITaxService taxService = null;
try {
taxService = (ITaxService) registry.lookup("TaxService");
} catch (RemoteException e) {
System.out.println(e);
}






java rmi connection-refused






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 17:49









Laurenz Albe

41.4k92746




41.4k92746










asked Nov 10 at 17:34









Luiza

42




42












  • Did you run the RMI registry?
    – Henry
    Nov 10 at 18:26










  • Henry, Firstly I executed the server side and it worked and after that when I tried to executed the client side I got this error message. The error came from this line registry = LocateRegistry.getRegistry("localhost", 8889);
    – Luiza
    Nov 10 at 20:49












  • (1) Are you installing the RMISecurityManager? If yes, you may need to tweak the securlty policy to allow connections to localhost:8889 ... (2) After you start the server, assuming it stays up and running, can you open a second terminal and telnet to localhost 8889 ? If yes, the server is there, so it's a client issue; if no, then it's a server issue ...
    – moilejter
    Nov 11 at 23:36


















  • Did you run the RMI registry?
    – Henry
    Nov 10 at 18:26










  • Henry, Firstly I executed the server side and it worked and after that when I tried to executed the client side I got this error message. The error came from this line registry = LocateRegistry.getRegistry("localhost", 8889);
    – Luiza
    Nov 10 at 20:49












  • (1) Are you installing the RMISecurityManager? If yes, you may need to tweak the securlty policy to allow connections to localhost:8889 ... (2) After you start the server, assuming it stays up and running, can you open a second terminal and telnet to localhost 8889 ? If yes, the server is there, so it's a client issue; if no, then it's a server issue ...
    – moilejter
    Nov 11 at 23:36
















Did you run the RMI registry?
– Henry
Nov 10 at 18:26




Did you run the RMI registry?
– Henry
Nov 10 at 18:26












Henry, Firstly I executed the server side and it worked and after that when I tried to executed the client side I got this error message. The error came from this line registry = LocateRegistry.getRegistry("localhost", 8889);
– Luiza
Nov 10 at 20:49






Henry, Firstly I executed the server side and it worked and after that when I tried to executed the client side I got this error message. The error came from this line registry = LocateRegistry.getRegistry("localhost", 8889);
– Luiza
Nov 10 at 20:49














(1) Are you installing the RMISecurityManager? If yes, you may need to tweak the securlty policy to allow connections to localhost:8889 ... (2) After you start the server, assuming it stays up and running, can you open a second terminal and telnet to localhost 8889 ? If yes, the server is there, so it's a client issue; if no, then it's a server issue ...
– moilejter
Nov 11 at 23:36




(1) Are you installing the RMISecurityManager? If yes, you may need to tweak the securlty policy to allow connections to localhost:8889 ... (2) After you start the server, assuming it stays up and running, can you open a second terminal and telnet to localhost 8889 ? If yes, the server is there, so it's a client issue; if no, then it's a server issue ...
– moilejter
Nov 11 at 23:36

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241634%2fconnection-refused-to-host-localhost%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241634%2fconnection-refused-to-host-localhost%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma