You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Nat Gross <na...@gmail.com> on 2007/08/05 19:59:48 UTC

remote network server - connection refused

Although I am using the -h option on the server, a client still can't
connect due to 'connection refused'.

On machine whose ip address is: 192.168.1.112, I tried
1. startNetworkServer -h 192.168.1.101
2.startNetworkServer -h 192.168.1.0
3.startNetworkServer -h 0.0.0.0

But when trying to connect from 192.168.1.101, I get the connection refused
message.
The firewall on  the  112  machine is set to allow all traffic from and to
the 101 machine.

Please advise.
Thanks,
nat

Re: remote network server - connection refused

Posted by Andrew McIntyre <mc...@gmail.com>.
On 8/6/07, John Embretsen <Jo...@sun.com> wrote:
>
> I believe startNetworkServer (or any of the other scripts) does not pass any
> options you specify on the command line along to the network server, which means
> that the -h option you specified is ignored, and your server will only listen on
> the local loopback interface.

Actually, it's only startNetworkServer and stopNetworkServer that
don't pass additional arguments on to NetworkServerControl. It would
be simple to fix this, by adding $@ to the shell script versions and
%DERBY_CMD_LINE_ARGS% to the batch versions to the lines with the
NetworkServerControl command.

I've made this change with revision 563340.

Re: remote network server - connection refused

Posted by Nat Gross <na...@gmail.com>.
On 8/6/07, John Embretsen <Jo...@sun.com> wrote:
>
> Sorry for the typo (missing command):
>
> John Embretsen wrote:
>
> > c) Invoke the Network Server main class directly, for example:
> > java -cp lib/derbynet.jar org.apache.derby.drda.NetworkServerControl -h
> > 0.0.0.0
>
> Should be:
>
> java -cp lib/derbynet.jar org.apache.derby.drda.NetworkServerControl start
> -h
> 0.0.0.0
>
> --
> John
>
>
Yes!
Also thanks for explaining the -h option.
I didn't  'get it'  until reading your explanation.

nat

Re: remote network server - connection refused

Posted by John Embretsen <Jo...@Sun.COM>.
Sorry for the typo (missing command):

John Embretsen wrote:

> c) Invoke the Network Server main class directly, for example:
> java -cp lib/derbynet.jar org.apache.derby.drda.NetworkServerControl -h 
> 0.0.0.0

Should be:

java -cp lib/derbynet.jar org.apache.derby.drda.NetworkServerControl start -h 
0.0.0.0


-- 
John


Re: remote network server - connection refused

Posted by John Embretsen <Jo...@Sun.COM>.
Nat Gross wrote:
> Although I am using the -h option on the server, a client still can't 
> connect due to 'connection refused'.
> 
> On machine whose ip address is: 192.168.1.112 <http://192.168.1.112>, I 
> tried
> 1. startNetworkServer -h 192.168.1.101 <http://192.168.1.101>
> 2.startNetworkServer -h 192.168.1.0 <http://192.168.1.0>
> 3.startNetworkServer -h 0.0.0.0 <http://0.0.0.0>
> 
> But when trying to connect from 192.168.1.101 <http://192.168.1.101>, I 
> get the connection refused message.
> The firewall on  the  112  machine is set to allow all traffic from and 
> to the 101 machine.

I believe startNetworkServer (or any of the other scripts) does not pass any 
options you specify on the command line along to the network server, which means 
that the -h option you specified is ignored, and your server will only listen on 
the local loopback interface.

Some possible solutions:

a) Edit the startNetworkServer script to include the -h option (you can either 
hard code the option or make the script more advanced by reading options from 
the command line.)

b) Use derbyrun.jar (available with Derby 10.2.1.6 or newer) instead, for example:
java -jar lib/derbyrun.jar server start -h 0.0.0.0

c) Invoke the Network Server main class directly, for example:
java -cp lib/derbynet.jar org.apache.derby.drda.NetworkServerControl -h 0.0.0.0

Besides, I think the first and second values of the -h option you specified will 
not work the way you may think. The -h option specifies which interface the 
server will listen on, so specifying the IP address of another host won't help.
"-h 192.168.1.112" and "-h 0.0.0.0" should work, though.

Hope this helps,

-- 
John