Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RMI lookup connect timeout (private IP, proxy, firewall, CGI)

13 views
Skip to first unread message

Yuri

unread,
Mar 24, 2002, 11:51:54 AM3/24/02
to
Hello,

I've written an academic application based on RMI and there's one
(last?) major problem that I can't get rid of. Can anybody tell me
what's wrong and whether it can be fixed and if yes how?

The server runs on a Linux machine in a DMZ behind the firewall,
ports 80 (Apache), 1099 (rmiregistry) as well as 4321 (for exported
objects) are open. The server makes callbacks.

Everything works if the client is on a machine with a permanent
IP address and direct Internet connection. It even seems to work
if the client dials in over an ISP.

Now _my_ computer on the campus LAN (different from where the server
runs) has a private IP only (172.x.x.x) and _has_ to use a (Web) proxy
on port 80 to accesss the Internet. A Socks proxy is not available.
DNS resolves the computer name (myhost.mydomain.de) to 172.x.x.x
(from remote subnetworks as well). When I start the client (either under
Windows or Linux), after a couple of _minutes_ an Exception is thrown:

<code>

java -classpath . -Djava.security.policy=./java.policy
-Djava.rmi.server.codebase=
http://serverhost.domain.de:80/path/myclasses.jar
-Djava.rmi.server.hostname=myhost.mydomain.de
-Djava.naming.provider.url=rmi://serverhost.domain.de:1099
-Dhttp.proxyHost=proxy.mydomain.de
-Djava.rmi.server.disable.Http=false
-jar ../client.jar

Objects will be exported to port # 12343
FixedPortSocketFactory.createSocket(serverhost.domain.de:1099)
java.rmi.ConnectException: Connection refused to host:
serverhost.domain.de; nested exception is:
java.net.ConnectException: Operation timed out: connect
java.net.ConnectException: Operation timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
at java.net.PlainSocketImpl.connectToAddress
(PlainSocketImpl.java:133)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
at java.net.Socket.<init>(Socket.java:273)
at java.net.Socket.<init>(Socket.java:100)
at FixedPortSocketFactory.createSocket
(FixedPortSocketFactory.java:40)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
at sun.rmi.transport.tcp.TCPChannel.createConnection
(TCPChannel.java:190)
at sun.rmi.transport.tcp.TCPChannel.newConnection
(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at MyMainClass.main(MyMainClass.java:94)

</code>

where

<code>
RMISocketFactory.setSocketFactory(new FixedPortSocketFactory(4321));

public class FixedPortSocketFactory extends RMISocketFactory {
// code skipped here
/** Ignores the parameter and always creates a server socket at
* the fixed port.
*/
public ServerSocket createServerSocket(int port) throws IOException {
return new ServerSocket(fixedPort);
}
public Socket createSocket(String host, int port) throws IOException {
return new Socket(host, port);
}}

</code>

This how I start the server on a remote machine:

<code>

java -classpath . -Djava.rmi.server.hostname=11.10.9.8
-Djava.rmi.server.useLocalHostname=true
-Djava.rmi.server.codebase=
http://serverhost.domain.de:80/path/myclasses.jar
-Djava.security.policy=./java.policy -jar server.jar

</code>

(all computer names and IPs changed for privacy reasons)

I've put java-rmi.cgi to Apache's cgi-bin/ on the server machine,
and it responds with an error message (Java RMI Client Error: can
only forward POST requests) to my "requests" a la
http://serverhost.domain.de/cgi-bin/java-rmi.cgi?forward=1099 in a
web browser - so it is at least launched. Setting
-Djava.rmi.server.disable.Http
to true or false when starting the client changes nothing.


It seems to me like either something has yet to be configured for
HTTP-tunneling (how?) - or the private IP is the problem (or the
proxy). The latter would probably mean that I _can't_ solve this
problem. (Or does FixedPortSocketFactory cause the error?)

Many thanks for your help.

--
Yuri Babich
Student of Computer Science
University of Erlangen-Nuremberg
Germany

Roedy Green

unread,
Mar 24, 2002, 1:37:40 PM3/24/02
to
On 24 Mar 2002 08:51:54 -0800, bab...@gmx.de (Yuri) wrote or quoted :

>Now _my_ computer on the campus LAN (different from where the server
>runs) has a private IP only (172.x.x.x) and _has_ to use a (Web) proxy
>on port 80 to accesss the Internet.

I seem to recall browsing a few days ago a paragraph about what you
have to do to force RMI to use HTTP in such a situation. Sorry I
can't give any details other than that the process did not appear to
be automatic.


The java glossary is at
http://www.mindprod.com/jgloss.html
or http://209.139.205.39

--
eagerly seeking telecommuting programming work.
canadian mind products, roedy green

DMB2Step67

unread,
Mar 24, 2002, 9:45:25 PM3/24/02
to
Although I can't give you complete details you might consider packaging
your objects within XML and those can cleanly be tunneled though the
HTTP protocol. Hope that gives you a little sense of direction.
0 new messages