Failure with Standalone Server and login with URLRemoteRepository

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Failure with Standalone Server and login with URLRemoteRepository

rick_tem
Hi, I'm new to Jackrabbit, I have the following initialization code accessing a remote server public void initialize() throws Exception { try { Repository repository = new URLRemoteRepository("http://10.41.5.51:8081/rmi"); //session = repository.login(); session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); rootNode = session.getRootNode(); } catch (Exception e) { logger.error("Error in JackRabbitPlugin initialize: ", e); throw e; } } Both login lines above fail with org.apache.jackrabbit.rmi.client.RemoteRepositoryException: java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: java.net.ConnectException: Connection refused: connect I used admin/admin to log into the http://10.41.5.51:8081/repository/default which works...Unclear to me why my local host is being referenced in the error...jackrabbit-jcr-rmi-2.14.0.jar and jackrabbit-core-2.14.0.jar are referenced in the classpath of my client. As well, can see the following in the access log of the jackrabbit server... 10.42.201.203 - - [07/Mar/2017:14:34:13 +0000] "GET /rmi HTTP/1.1" 200 212 "-" "Java/1.8.0_66" If this isn't the correct way to handle remote login, what should it be? Server started with: tafj@chdsk-tafjdev1:~/jackrabbit$ java -Xmx256m -jar jackrabbit-standalone-2.14.0.jar --host 10.41.5.51 --port 8081 Welcome to Apache Jackrabbit! ------------------------------- Using repository directory jackrabbit Writing log messages to jackrabbit/log Starting the server... Apache Jackrabbit is now running at http://10.41.5.51:8081/
Reply | Threaded
Open this post in threaded view
|

Re: Failure with Standalone Server and login with URLRemoteRepository

rick_tem
I figured this out.  You have to start the server with:

-Djava.rmi.server.hostname=10.41.5.51

In my opinion this is a bug, why should I have to specify this property if I've done so with --host param?

$ java -Xmx256m -Djava.rmi.server.hostname=10.41.5.51 -jar jackrabbit-standalone-2.14.0.jar --host 10.41.5.51 --port 8081

Best,
Rick