Hello:
I've trying to understand the RMI API that is in extension-jcr-rmi-1.0.0-src.zip in order to use it to develop a layer for my Company.
I've installed it successfully. I've also added and configured properly this module (in order to solve the issue commented in the forum):extension-jcr-thread-bound-1.1.jar
I've run the test called jcrRmiTest.jsp and it works. So, I've tried to make a small program following the example in jcrRmiTest.jsp and using ECLIPSE to develop and run it.
My environment is:
a Virtual Machine with DEBIAN where Alfresco is installed. There, I run the RMIREGISTRY. I work from my localhost and try to connect to ALFRESCO using RMI, and I get this exception when trying to login:
unexpected exception encountered [org.apache.jackrabbit.rmi.client.RemoteRepositoryException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused: connect: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused: connect]
I've checked that in the file: authority-services-context.xml is the user admin admin.
I've tried also to change the famous RMI port to 50502 on alfresco-shared.properties and that's even worst because it doesn't bind….
Any suggestion?
Your help is much appreciated.
This is the source code:
import java.rmi.Naming;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
import org.apache.jackrabbit.rmi.remote.RemoteRepository;
public class Connection {
public static void main(String[] pArgs)
{
/* define locals */
String vRmiRegistryLocation = null;
Object vRemoteObjectReference = null;
Repository vJcrRepository = null;
LocalAdapterFactory vLocalAdapterFactory = null;
Session vJcrSession = null;
Node vJcrNode = null;
String vRmiServerName = null;
String vRmiServerPort = null;
String vRmiBindingName = null;
/* initialize */
vLocalAdapterFactory = new ClientAdapterFactory();
try
{
/* get command line arguments for connection parameters */
vRmiServerName = "192.168.1.102";
vRmiServerPort = "1099";
vRmiBindingName = "javaContentRepository";
vRmiRegistryLocation = "//"+vRmiServerName;
vRmiRegistryLocation += ":"+vRmiServerPort;
vRmiRegistryLocation += "/"+vRmiBindingName;
System.out.println("looking up remote reference at ["+vRmiRegistryLocation+"]");
System.out.println("**"+Naming.list("//"+vRmiServerName+ ":"+vRmiServerPort)+"**");
vRemoteObjectReference = Naming.lookup(vRmiRegistryLocation);
System.out.println("creating local adapter for remotereference ["+vRemoteObjectReference+"]");
vJcrRepository = vLocalAdapterFactory.getRepository((RemoteRepository)vRemoteObjectReference);
System.out.println("[" +vJcrRepository.toString()+ "]");
System.out.println("logging in as admin admin to default workspace");//here appears the exception…
vJcrSession = vJcrRepository.login(new SimpleCredentials("admin", "admin".toCharArray()));
System.out.println("looking up workspace root node");
vJcrNode = vJcrSession.getRootNode();
System.out.println("root node name["+vJcrNode.getName()+"]");
}
catch(Exception eTestFailure)
{
System.out.println("unexpected exception encountered ["+eTestFailure+"]");
}
}
}