NAT / Firewalls / Router / Grief
Cam Roe <[email protected]> Tue, 11 Mar 2008 20:45:21 -0600
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <023701c883eb$1d9a64f0$4301a8c0@glacier> |
Hi all,
Just trying out River 2.1 and am working my way through some issues. I must
admit to being very behind the times with regard to Jini after 1.2 so
apologize if this has been gone over before.
Anyway, I have reggie and the httpserver running on one network and a
HelloService example running on a 2nd network (Diagram below). When I run an
older reggie(1.2) or JMatos this works fine, but under the 2.1 I seem to
have something not set correctly. I start the HttpServer, Reggie and a
ServiceBrowser (just for the heck of it:-) ) using the bat/config files
listed below. It seems to work fine … to a point. All the services start up
on on the left (LUS side on the diagram link) and then I switch to the
Service Provider side(other network) and try to do a single lookup (using a
single instance of a LookupLocator aimed at psinaptic.com,4160
LookupLocator[] psill = {new LookupLocator("psinaptic.com", 4160)};
My HelloServiceRegistrationManager class constructs a JoinManager with the
single LookupLocator and tries to register the service. It also implements
the following:
public class HelloServiceRegistrationManager implements ServiceIDListener,
LeaseListener, DiscoveryListener {
As such it has a discovered method (DiscoveryListener)
public void discovered(DiscoveryEvent e) {
ServiceRegistrar[] sr = e.getRegistrars();
for (int i = 0; i < sr.length; i++) {
try {
logger.log(Level.INFO, "New LUS on " +
sr[i].getLocator().getHost() + " has been discovered.");
} catch (RemoteException ex) {
logger.log(Level.SEVERE, "What the F.........", ex);
}
}
}
I get the following exception (as you guessed) being thrown from the
discovered method while running on pc 192.168.100.100
Mar 5, 2008 11:51:56 PM
com.psinaptic.examples.hello_joinmanager.HelloServiceRegistrationManager
discovered
SEVERE: What the F.........
java.rmi.ConnectException: connection refused or timed out to
BasicObjectEndpoint[05b3e9bd-3766-4d8b-a8f2-4ab8fcaa5651,TcpEndpoint[192.168
.0.101:4089]]; nested exception is:
java.net.ConnectException: Connection timed out: connect
at
net.jini.jeri.BasicInvocationHandler.wrapSafeIOException(BasicInvocationHand
ler.java:890)
at
net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationH
andler.java:711)
at
net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandl
er.java:659)
at
net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:528)
at com.sun.jini.reggie.$Proxy0.getLocator(Unknown Source)
at
com.sun.jini.reggie.RegistrarProxy.getLocator(RegistrarProxy.java:215)
at
com.psinaptic.examples.hello_joinmanager.HelloServiceRegistrationManager.dis
covered(HelloServiceRegistrationManager.java:203)
at
net.jini.discovery.LookupDiscoveryManager.notifyListener(LookupDiscoveryMana
ger.java:1372)
at
net.jini.discovery.LookupDiscoveryManager.notifyListener(LookupDiscoveryMana
ger.java:1356)
at
net.jini.discovery.LookupDiscoveryManager.access$500(LookupDiscoveryManager.
java:92)
at
net.jini.discovery.LookupDiscoveryManager$LocatorDiscoveryListener.discovere
d(LookupDiscoveryManager.java:439)
at
net.jini.discovery.LookupLocatorDiscovery$Notifier.run(LookupLocatorDiscover
y.java:637)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at
net.jini.jeri.tcp.TcpEndpoint$ConnectionEndpointImpl.connectToSocketAddress(
TcpEndpoint.java:678)
at
net.jini.jeri.tcp.TcpEndpoint$ConnectionEndpointImpl.connectToHost(TcpEndpoi
nt.java:608)
at
net.jini.jeri.tcp.TcpEndpoint$ConnectionEndpointImpl.connect(TcpEndpoint.jav
a:543)
at
net.jini.jeri.connection.ConnectionManager.connect(ConnectionManager.java:22
8)
at
net.jini.jeri.connection.ConnectionManager$ReqIterator.next(ConnectionManage
r.java:629)
at
net.jini.jeri.BasicObjectEndpoint$1.next(BasicObjectEndpoint.java:371)
at
net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationH
andler.java:708)
... 10 more
What is wrong with this picture is that some proxy(ServiceRegistrar I think)
tagged itself with a local DHCP served address (192.168.0.101) and when the
proxy arrives at the client end, is trying to get back across the network to
that locally served dhcp address behind a firewall of 192.168.0.101. This
address is (I think) obtained from a call to some sort of ‘getHostAddress’
somewhere. I’m pretty sure I remember a problem like this writing JMatos and
we solved it by simply putting in a property that basically said ‘always
refer to me as this host no matter what getHostAddress() says’. So my
questions are as follows
1. Is there a configuration setting to set the ‘host’ to be always
psinaptic.com or some other ip address when running reggie? (I thought I had
done that with the unicastDiscoveryHost)
But I guess not. :-) Is there a Windows/hosts/ipconfig setting? (i.e.
should I set the local machine to have a host name of psinaptic.com?)
2. Do I have to open any ports besides 4160(jini), 1098(RMID) and 8080(http
Server) on my firewall? (4089 for example?)
Thanks for your help! (Going back to the old insecure ways for awhile….)
Cheers
Cam
PS. All running on XP boxes.
THE NETWORK (I forgot to note that the RMID port 1098 is also port
forwarded)
HYPERLINK
"http://www.psinaptic.com/images/network.jpg"http://www.psinaptic.com/images
/network.jpg
The ubiquitous start.bat
set JINI_INSTALLDIR="C:\Program Files\jini2_1"
java -Djava.security.policy=config/jsk-all.policy -jar
%JINI_INSTALLDIR%/lib/start.jar config/start-transient-basic-services.config
start-transient-basic-services.config
import com.sun.jini.start.NonActivatableServiceDescriptor;
import com.sun.jini.start.ServiceDescriptor;
com.sun.jini.start {
private static host="psinaptic.com";
private static port="8080";
//
// BROWSER
//
private static browser_codebase = "http://" + host+ ":" + port+
"/browser-dl.jar http://" + host+ ":" + port+ "/jsk-dl.jar";
private static browser_policy = "config/jsk-all.policy";
private static browser_classpath = "C:/Program
Files/jini2_1/lib/browser.jar";
private static browser_impl = "com.sun.jini.example.browser.Browser";
private static browser_config = "config/browser.config";
private static browser_service =
new NonActivatableServiceDescriptor(
browser_codebase,browser_policy,browser_classpath,browser_impl,
new String[] { browser_config });
//
// HTTPD Service
//
private static httpd_codebase = "";
private static httpd_policy = "config/jsk-all.policy";
private static httpd_classpath = "C:/Program
Files/jini2_1/lib/classserver.jar";
private static httpd_impl = "com.sun.jini.tool.ClassServer";
private static httpd_service =
new NonActivatableServiceDescriptor(
httpd_codebase, httpd_policy, httpd_classpath, httpd_impl,
new String[]{"-port", port, "-dir", "codebaseroot",
"-verbose"});
//
// Reggie (Lookup Service)
//
private static reggie_codebase = "http://" + host+ ":" + port+
"/reggie-dl.jar"
+ " http://" + host+ ":" + port+ "/jsk-dl.jar";
private static reggie_policy = "config/jsk-all.policy";
private static reggie_classpath = "C:/Program
Files/jini2_1/lib/reggie.jar";
private static reggie_config = "config/transient-reggie.config";
private static reggie_impl =
"com.sun.jini.reggie.TransientRegistrarImpl";
private static reggie_service =
new NonActivatableServiceDescriptor(
reggie_codebase, reggie_policy, reggie_classpath,
reggie_impl, new String[] { reggie_config });
static serviceDescriptors = new ServiceDescriptor[] {
httpd_service,
reggie_service,
browser_service
};
}
reggie.config
com.sun.jini.reggie {
initialMemberGroups = new String[] { "" };
unicastDiscoveryHost = "psinaptic.com";
}
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.518 / Virus Database: 269.21.7/1324 - Release Date: 3/10/2008
7:27 PM
--------------------------------------------------------------------------
Getting Started: http://www.jini.org/wiki/Category:Getting_Started
Community Web Site: http://jini.org
jini-users Archive: http://archives.java.sun.com/archives/jini-users.html
Unsubscribing: email "signoff JINI-USERS" to [email protected]