Registro rmi

4 respostas
D

Fala pessoal,

Registry r = LocateRegistry.createRegistry(port);

Quando crio um registro em uma porta diferente da 1099 através do código acima.
Até ai, blz…

Mas quando tento dar um Naming.rebind("//192.168.0.10/Objeto",obj) ocorre o seguinte erro:

java.rmi.ConnectException: Connection refused to host: 192.168.0.10; nested exception is:
java.net.ConnectException: Connection refused: connect

at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)

at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)

at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)

at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)

at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)

at java.rmi.Naming.rebind(Naming.java:160)

at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)

at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)

at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)

... 8 more

Mas isso somente se a porta for diferente de 1099.

Valeu!!!

4 Respostas

J

Hmm … ja pensou em seu firewall ?
“Mas isso somente se a porta for diferente de 1099”

D

Eis a questão, não tenho nada desse tipo.

Quando uso a porta 1099 roda beleza.

Só que está aplicação rodará na mesma máquina do Application Server por isso preciso usar uma porta diferente da 1099.

T

Naming.rebind("//192.168.0.10/Objeto",obj)

Bom, onde é que você especifica o número da porta?

No Javadoc ele diz:
[i]
The Naming class provides methods for storing and obtaining references to remote objects in a remote object registry. Each method of the Naming class takes as one of its arguments a name that is a java.lang.String in URL format (without the scheme component) of the form:

//host:port/name

[/i]

isto quer dizer que você precisa especificar a porta também em Naming.rebind.

D

Obrigado, valeu mesmo!!!

Funcionou perfeito!!!

Até Mais,
Alan

Criado 29 de novembro de 2004
Ultima resposta 30 de nov. de 2004
Respostas 4
Participantes 3