| Author |
Message |
|
| charade |
Posted: Wed Jun 23, 2010 10:15 pm |
|
|
|
Joined: 05 May 2010
Posts: 5
|
Hi, I have a problem trying to communicate different processes by using JInterface. I have an erlang process (acting as a server) and two Java processes.
When executing erlang, I've tried this:
erl -setcookie cookie -sname server
Erlang R13B02 (erts-5.7.3) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
Eshell V5.7.3 (abort with ^G)
(server@charade)1>
And from JInterface:
String server = "server@charade";
OtpMBox mbox = node.createMbox(username);
if(!mbox.ping(server, 2000)){
System.out.println("Error connecting");
}else{
System.out.println("Connected to the server");
}
It works if all processes are executed from the same computer. Otherwise, it doesn't create the connection. Why could it happen? I've tried adding the IP and the host "charade" to the hosts file, but still doesn't work when trying from differen computers
Thanks in advance! |
|
|
| Back to top |
|
| zajda |
Posted: Thu Jun 24, 2010 9:16 am |
|
|
|
User
Joined: 22 Aug 2009
Posts: 83
|
You didn'n write how are your hosts connected, but, to begin, try starting shell with fully qualified name.
Instead of -sname use -name server@(IP or Host). |
|
|
| Back to top |
|
| charade |
Posted: Thu Jun 24, 2010 10:19 am |
|
|
|
Joined: 05 May 2010
Posts: 5
|
To start, I've tried with two computers connected to the same local network. Although, I'd like to make it work on the internet.
I've tried what you said: -setcookie cookie -name server@charade, but when I execute the client, I get this error "Nameserver not responding on zzz01 when publishing node client"
I've added into the hosts file, the line
192.168.1.33 charade
But still the same thing
Thanks for your help! |
|
|
| Back to top |
|
| charade |
Posted: Thu Jun 24, 2010 12:26 pm |
|
|
|
Joined: 05 May 2010
Posts: 5
|
If I do nodes(), it returns an empty list. If I try what you said, it returns:
(server@charade)14> net_kernel:connect('client@charade').
false
=ERROR REPORT==== 24-Jun-2010::14:18:33 ===
** System running to use fully qualified hostnames **
** Hostname charade is illegal **
(server@charade)15> net_kernel:connect('client@charade').
false |
|
|
| Back to top |
|
| zajda |
Posted: Thu Jun 24, 2010 12:26 pm |
|
|
|
User
Joined: 22 Aug 2009
Posts: 83
|
can you net_adm:ping( 'java@node' ) form erlang shell?
nodes() should return nothing because JVM nodes are hidden.
btw. please, copy-paste java code where you create otp node. It might be not a problem with -sname or -name but with long/short node name (with part after @)
/edit/ also run erlang node with -sname but with long name: -sname aa@add_host_here |
|
|
| Back to top |
|
| charade |
Posted: Thu Jun 24, 2010 1:01 pm |
|
|
|
Joined: 05 May 2010
Posts: 5
|
From java:
OtpNode node = new OtpNode("client", "cookie");
OtpMbox mbox = node.createMbox("client_mbox");
mbox.ping("server@charade", 2000);
From erlang:
erl -setcookie cookie -name server@charade
(also tried with -sname). And the result is:
"Nameserver not responding on zzz01 when publishing node client"
I've also tried to create the node like this:
OtpNode node = new OtpNode("client@charade", "cookie");
but the error I get is:
"Nameserver not responding on charade when publishing node client" |
|
|
| Back to top |
|
| charade |
Posted: Mon Jul 05, 2010 9:35 am |
|
|
|
Joined: 05 May 2010
Posts: 5
|
I still have this problem and no idea how to solve it, any help? I have tried everything I came up with, but nothing  |
|
|
| Back to top |
|
| zajda |
Posted: Tue Jul 06, 2010 10:41 am |
|
|
|
User
Joined: 22 Aug 2009
Posts: 83
|
it is hard to debug this kind of issue remotely.
Maybe lets start from the begging
Make sure you can ping from unix shell both nodes.
Check if epmd is runnin. What about firewall?
Fire up both nodes in the local network with -sname but stick to the name @IP (where IP is host ip). Remove all etc/hosts entries involved before.
could you paste whole, minimum code you are using (or give a link to it)? |
|
|
| Back to top |
|
| Gavin |
Posted: Thu Jul 28, 2011 5:14 am |
|
|
|
Joined: 22 Jul 2011
Posts: 3
|
| Strange to see this post – I have the same problem and it is really strange that while using JInterface, there is this hassle of getting connected to different hosts!! Considering that we are doing everything right, I am curious about what the reason for this issue could be!! Hope someone will come up with the correct credentials fast!! |
|
|
| Back to top |
|
| NedFrank |
Posted: Wed Dec 21, 2011 2:54 pm |
|
|
|
Joined: 21 Dec 2011
Posts: 7
Location: Kansas
|
|
| Back to top |
|
|
|