Hi All,

I am newbie to java, trying to connect to linux server using my vista window, network admin has opened the port for me, and I am using an API built by colleague to connect to server remotely.

I got the following exceptions, anyone know how to make it works ? The server url is 192.168.1.100, port is 2001.

I reckon problem could be with rmi.Naming.lookup,

Many thanks.

[LinguaAPI] Establish connection to rmi://192.168.1.100:2001/LXBaseServe
java.rmi.ConnectException: Connection refused to host: 192.168.1.100; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at com.linguamatix.lxbase.LinguaAPI.connect(LinguaAPI.java:27)
at com.linguamatix.lxbase.LinguaAPI.<init>(LinguaAPI.java:20)
at com.linguamatix.lxbase.CheckLinguaAPI.main(CheckLinguaAPI.java:49)
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 java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:179)
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:595)
... 8 more

Me again, the following is code on client side

======

public class CheckLinguaAPI
{
        public static void main(String[] args) throws IOException
        {

         String UrlAdd = "192.168.1.222";
         int PortNum = 2001;

        // LocateRegistry.getRegistry(UrlAdd,PortNum);

         LinguaAPI lind = new LinguaAPI(UrlAdd, PortNum);
        }

}

===

Thanks in advance

Remote Method Invocation is the best for the remote systems this is used for connecting to the difftent systems in the different manner.

<snip>

Hi adam,

Are you saying I can't do it in this manner ? I am using internet connection, but network admin has approved my IP an opened the port for me. The interface and connecting API (archived in jar) have been imported into my project's library.

So, I just use the constructor LinguaAPI which has all the rmi, am I doing it the right way ? I can't seem to find any mistakes.

Cheers,

QUOTE=adamjoj;663034]Remote Method Invocation is the best for the remote systems this is used for connecting to the difftent systems in the different manner.
===========================================================
<snip>

Why would you not ask your colleague, seeing as he wrote the API?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.