Search the web
Sign In
New User? Sign Up
jcr-crx
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
rmi call does not return repository   Message List  
Reply | Forward Message #460 of 790 |
Re: rmi call does not return repository

Hi All,
I am using Cq 4.2 and trying to access the CRX Repository using RMI and my test java application is as below:
package com;
import javax.jcr.Repository;
import javax.jcr.SimpleCredentials;
import javax.jcr.Session;
import javax.jcr.Workspace;
import javax.jcr.Node;
import javax.jcr.nodetype.NodeType;
import javax.jcr.NodeIterator;
import javax.jcr.PropertyIterator;
import javax.jcr.Property;
import javax.jcr.PropertyType;
import org.apache.jackrabbit.rmi.client.*;

public class access {
 public static void main(String[] args) {
//   TODO Auto-generated method stub
  String repoUrl = "//localhost:1234/crxauthor";
  Repository repository;
  try {
  ClientRepositoryFactory factory = new ClientRepositoryFactory();
  System.setProperty("java.rmi.server.useCodebaseOnly", "true");
  repository = factory.getRepository(repoUrl);
  
  System.out.println(repository.getDescriptor(repository.REP_NAME_DESC));

  } catch (Exception ex) {
// handle exception
  ex.printStackTrace();
  }
  }
}
I have uncommented the rmi-port element in the web.xml located at
<cq-install>\server\runtime\0\_crxauthor\WEB-INF.

But i am unable to connect to the crx and recieve the following exception:
java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
 java.net.ConnectException: Connection refused: connect
 at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
 at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
 at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
 at sun.rmi.server.UnicastRef.newCall(Unknown Source)
 at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
 at java.rmi.Naming.lookup(Unknown Source)
 at org.apache.jackrabbit.rmi.client.ClientRepositoryFactory.getRepository(ClientRepositoryFactory.java:86)
 at com.access.main(access.java:29)
Caused by: java.net.ConnectException: Connection refused: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(Unknown Source)
 at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
 at java.net.PlainSocketImpl.connect(Unknown Source)
 at java.net.SocksSocketImpl.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at java.net.Socket.<init>(Unknown Source)
 at java.net.Socket.<init>(Unknown Source)
 at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
 at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
 ... 8 more

I have included both the crx-rmi-1.3.1.jar and jcr-1.0.jar in the Eclipse application's classpath as well.

If anyone could kindly suggest where am i committing some error or leaving out any step.

with thanks,

Hemant

 


--- In jcr-crx@yahoogroups.com, "Jongwook Woo" <dalgual@...> wrote:
>
> Hi Felix:
>
> Thanks for the mail. However, it still does not work. I am using
> CQ4.0 and it seems you meant crxauthor for "crx".
>
> in web.xml, there are two rmi related lines:
> <init-param>
> <param-name>rmi-port</param-name>
> <param-value>0</param-value>
> <description>
> The RMI port for registering the repository in
> the RMI Registry.
> If equals 0, the default port is used. Ommit
> this parameter, to
> disable RMI server completely.
> </description>
> </init-param>
>
> <init-param>
> <param-name>rmi-uri</param-name>
> <param-value>//localhost:1099/jcrAuthor</param-value>
> </init-param>
>
> I uncommented them. And, I executed code and the following error:
>
> java.rmi.NotBoundException: jcrAuthor
> at sun.rmi.registry.RegistryImpl.lookup(Unknown Source)
>
> It seems that my url is wrong for RMI registry. This is the code:
> String repoUrl = "//localhost:1099/jcrAuthor";
> ClientRepositoryFactory factory = new ClientRepositoryFactory();
> try {
> repository = factory.getRepository(repoUrl);
>
> Thus, I modified the repoUrl as follows:
> repoUrl = "//localhost:1099/crxauthor";
>
> Then, I got followiong error:
> java.rmi.UnmarshalException: error unmarshalling return; nested
> exception is:
> java.net.MalformedURLException: no protocol: Files/Day/CQ-
> 4.0.1/server/runtime/0/_crxauthor/WEB-INF/classes
> at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
> at java.rmi.Naming.lookup(Unknown Source)
> at
> org.apache.jackrabbit.rmi.client.ClientRepositoryFactory.getRepositor
> y(ClientRepositoryFactory.java:86)
> at com.enetworks.eol.site.content.CRXHelper.main
> (CRXHelper.java:123)
> Caused by: java.net.MalformedURLException: no protocol: Files/Day/CQ-
> 4.0.1/server/runtime/0/_crxauthor/WEB-INF/classes
> at java.net.URL.<init>(Unknown Source)
>
>
> Is there something wrong in repoUrl?
>
>
> Regards,
>
> Jongwook
>
> --- In jcr-crx@yahoogroups.com, "fmeschbe" bark@ wrote:
> >
> > Hi,
> >
> > There is a 100% chance that no RMI registry is running at the
> > localhost:1099 ... There is all to it.
> >
> > But how come, nothing is there ? Easy: the default CRX installation
> > does not register the repository with RMI. You will have to do this
> > "by hand".
> >
> > 1. After first start locate the crx web app web.xml file in
> > runtime/0/_crx/WEB-INF folder of your CRX installation.
> > 2. Open the file with your preferred editor.
> > 3. Locate the rmi-port initial parameter
> > 4. This parameter is commented out by default
> > 5. Uncomment it
> > 6. Restart CRX
> >
> > Now you should be able to connect.
> >
> > Regards
> > Felix Meschberger
> >
> > --- In jcr-crx@yahoogroups.com, "Jongwook Woo" <dalgual@> wrote:
> > >
> > > Hi
> > >
> > > I wrote a code to call repository via RMI. But it returns the
> > > following error:
> > > java.rmi.ConnectException: Connection refused to host:
> localhost;
> > > nested exception is:
> > > java.net.ConnectException: Connection refused: connect
> > > at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown
> > > Source)
> > > at sun.rmi.transport.tcp.TCPChannel.createConnection
> > > (Unknown Source)
> > > at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown
> > > Source)
> > > at sun.rmi.server.UnicastRef.newCall(Unknown Source)
> > > at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
> > > at java.rmi.Naming.lookup(Unknown Source)
> > > at
> > >
> org.apache.jackrabbit.rmi.client.ClientRepositoryFactory.getRepositor
> > > y(ClientRepositoryFactory.java:86)
> > > at com.enetworks.eol.site.content.CRXHelper.main
> > > (CRXHelper.java:123)
> > >
> >
>



Tue Nov 6, 2007 12:05 pm

hemant.bellani
Offline Offline
Send Email Send Email

Forward
Message #460 of 790 |
Expand Messages Author Sort by Date

Hi I wrote a code to call repository via RMI. But it returns the following error: java.rmi.ConnectException: Connection refused to host: localhost; nested...
Jongwook Woo
dalgual
Offline Send Email
Mar 9, 2006
12:03 am

Hi, There is a 100% chance that no RMI registry is running at the localhost:1099 ... There is all to it. But how come, nothing is there ? Easy: the default CRX...
fmeschbe
Offline Send Email
Mar 9, 2006
1:31 pm

Hi Felix: Thanks for the mail. However, it still does not work. I am using CQ4.0 and it seems you meant crxauthor for "crx". in web.xml, there are two rmi...
Jongwook Woo
dalgual
Offline Send Email
Mar 9, 2006
5:58 pm

Hi Jongwook, We had problems with the rmi-uri parameter, therefore I would recommend to keep that commented and just use the rmi-port parameter. And, yes the ...
bark
fmeschbe
Offline Send Email
Mar 9, 2006
7:09 pm

Hi All, I am using Cq 4.2 and trying to access the CRX Repository using RMI and my test java application is as below: package com; import javax.jcr.Repository;...
hemant.bellani
Offline Send Email
Nov 6, 2007
1:04 pm

Hi Felix: Finally, I got it work. The repository name should be "crxauthor" not "jcrAuthor" for me. And, I found that I need to add one more statement before...
Jongwook Woo
dalgual
Offline Send Email
Mar 9, 2006
6:40 pm

Hi Jongwook, ... Cool. ... Oh yeah ! I forget about this all the time :-) ... I do not quite understand. What do you want to "Run as Java Application" ? Is it...
bark
fmeschbe
Offline Send Email
Mar 9, 2006
7:12 pm

... Hi felix: I added crx-rmi jar file into my eclipse project and I can execute my rmi client in Eclipse too. Thanks for your mail again ;-) Regards, JW ... ...
Jongwook Woo
dalgual
Offline Send Email
Mar 9, 2006
8:23 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help