Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jul 2001 01:51:57 +0100
From:      j mckitrick <jcm@FreeBSD-uk.eu.org>
To:        freebsd-java@freebsd.org
Subject:   argh!! Can't get bind/rmi to work....
Message-ID:  <20010703015156.A27017@dogma.freebsd-uk.eu.org>

next in thread | raw e-mail | index | archive | help

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii


Sorry in advance this isn't BSD specific, but i am frustrated to no end.  I
had a simple RMI program that binds to a port.  It works under 1.1, but not
1.2.  Could someone tell me why not?  It trips up on the Naming.rebind()
call.  I fussed with my securiy policy (finally have it working) and the url
format (complained it was malformed).  I am trying to connect to localhost.
I have rmiregistry running.

I whittle it down to only needing 2 small files.  Please help if you can,
i'm beating my head against a wall.

Here is the error message:

local:~/src/engine> java BindTest         
BindTest exception: Unknown host: BindTest; nested exception is: 
        java.net.UnknownHostException: BindTest
java.rmi.UnknownHostException: Unknown host: BindTest; nested exception is: 
        java.net.UnknownHostException: BindTest
java.net.UnknownHostException: BindTest
        at java.net.InetAddress.getAllByName0(InetAddress.java:577)
        at java.net.InetAddress.getAllByName0(InetAddress.java:546)
        at java.net.InetAddress.getByName(InetAddress.java:455)
        at java.net.Socket.<init>(Socket.java:98)
        at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:29)
        at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:124)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:497)
        at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:194)
        at
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:178)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
        at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
        at java.rmi.Naming.rebind(Naming.java:165)
        at BindTest.main(BindTest.java:30)



Jonathon
--
Microsoft complaining about the source license used by 
Linux is like the event horizon calling the kettle black.

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="BindTest.java"

/* jonathon mckitrick */

import java.rmi.*;
import java.rmi.server.*;
import compute.*;

public class BindTest extends UnicastRemoteObject
                           implements Compute
{
	public BindTest() throws RemoteException 
	{
		super();
	}

	public Object executeTask() 
	{
		return null;
	}

	public static void main(String[] args) 
	{
		System.getSecurityManager();
//		if (System.getSecurityManager() == null) 
//			System.setSecurityManager(new RMISecurityManager());

		String name = "//BindTest";
		try 
		{
			Compute engine = new BindTest();
			Naming.rebind(name, engine);
			System.out.println("BindTest bound");
		} catch (Exception e) 
		{
			System.err.println("BindTest exception: " + e.getMessage());
			e.printStackTrace();
		}
	}
}

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Compute.java"

/* jonathon mckitrick */

package compute;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface Compute extends Remote 
{
	Object executeTask() throws RemoteException;
}

--nFreZHaLTZJo0R7j--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010703015156.A27017>