On 9/19/06, Vikas Bhatia <[EMAIL PROTECTED]> wrote:
Hi,
I am trying to login to a remote repository using a rmi client. I know
that port 1099 on the remote machine is accepting connection and there are
no firewall issues but my code fails at
session = repository.login (credentials, "testrep");
I can telnet to the port 1099 on the remote machine.
The trace message is
org.apache.jackrabbit.rmi.client.RemoteRepositoryException: Connection
refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect: Connection
refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at org.apache.jackrabbit.rmi.client.ClientRepository.login(
ClientRepository.java:99)
at com.co.cd.samples.Importer.main(Importer.java:223)
It seems that the client is trying to connect to the local machine for
some reason.
On debugging this is what I see in the ServerRepository_Stub remote
instance "ServerRepository_Stub[UnicastRef [liveRef: [endpoint:[
127.0.0.1:51964](remote),objID:[-306a124b:10dc6b3cde5:-8000, 0]]]]"
So the remote repository is getting bound to 127.0.0.1. Is this a bug or
am I missing something?
The java file is pasted below
==================
import java.net.MalformedURLException ;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import javax.jcr.Credentials;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.naming.NamingException;
import org.apache.jackrabbit.rmi.client.ClientRepositoryFactory;
public class RemoteRepLogin {
private static final String REPO_NAME =
"//172.16.100.58:1099/jackrabbit.repository";
private static final String USERID = "admin";
private static final char[] PASSWORD = "pwd".toCharArray();
private static Repository repository;
private static Session session;
private static Repository getRepository() throws NamingException,
RepositoryException, ClassCastException,
MalformedURLException,
RemoteException, NotBoundException {
String name = REPO_NAME; // The RMI URL of the repository
ClientRepositoryFactory factory = new ClientRepositoryFactory();
Repository repository = null;
repository = factory.getRepository(name);
return repository;
}
public static void main(String[] args) {
try {
repository = getRepository();
Credentials credentials = new SimpleCredentials(USERID,
PASSWORD);
session = repository.login(credentials, "testrep");
//exception thrown here...
System.out.println("Got session="+session);
} catch (Exception e) {
System.out.println("Yargg - an exception.");
e.printStackTrace();
}
}
}
===================
Thanks.
Vikas.
Well,
The same everything worked fine on a separate WinXP server box. So if there
are any linux firewall/port blocking/port releasing gurus here, tips
appreciated.
Thanks.