You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Paulo Silva <al...@gmail.com> on 2011/04/07 00:24:11 UTC

Code example to connect to repository via RMI?

Hi,

I have jackrabbit-jca-1.5.5.rar deployed in jboss 4.2.3GA and now I'm trying
to expose via RMI to connect to it via the GUI tool JCR-Controller v0.72.

I followed the instructions to expose RMI here:
http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss

I checked the jmx-console and it seems that the RMI is exposed correctly.

But now I have a problem: how can I connect to that repository via RMI? Does
someone have a code example / tutorial I can follow?


I tried many things with no luck, for example, if I try to put the url
"jnp://localhost:1099/jcrServer" in the JCR-Controller app, I get this
exception:
org.apache.jackrabbit.rmi.client.RemoteRepositoryException: Malformed URL:
jnp:/
/localhost:1099/jcrServer; nested exception is:
        java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099
/jcrServer: Malformed URL: jnp://localhost:1099/jcrServer; nested exception
is:



So, anyone can show me how to connect to that server?

Re: Code example to connect to repository via RMI?

Posted by Paulo Silva <al...@gmail.com>.
It's a maintenance project, so old libraries hooray!

I think it's something related to the way my JCR repository environment is
setup, it's deployed in JBoss 4.2.3GA, following instructions from:
http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss
(JCA and then RMI exposed).

Using the instructions in the page you mentioned I get:
 ClientRepositoryFactory factory = new ClientRepositoryFactory();
            Repository repository =
factory.getRepository("jnp://localhost:1099/jcrServer");
            Session session = repository.login();

Which causes:
org.apache.jackrabbit.rmi.client.RemoteRepositoryException: Malformed URL:
jnp://localhost:1099/jcrServer; nested exception is:
java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099/jcrServer: Malformed URL:
jnp://localhost:1099/jcrServer; nested exception is:
java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099/jcrServer
at
org.apache.jackrabbit.rmi.client.SafeClientRepository.remoteLogin(SafeClientRepository.java:112)
at
org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:120)
at
org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:136)
at MyConn.main(MyConn.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.rmi.RemoteException: Malformed URL:
jnp://localhost:1099/jcrServer; nested exception is:
java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099/jcrServer
at
org.apache.jackrabbit.rmi.client.ClientRepositoryFactory$1.getRemoteRepository(ClientRepositoryFactory.java:97)
at
org.apache.jackrabbit.rmi.client.SafeClientRepository.remoteLogin(SafeClientRepository.java:108)
... 8 more
Caused by: java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099/jcrServer
at java.rmi.Naming.intParseURL(Naming.java:273)
at java.rmi.Naming.parseURL(Naming.java:220)
at java.rmi.Naming.lookup(Naming.java:79)
at
org.apache.jackrabbit.rmi.client.ClientRepositoryFactory$1.getRemoteRepository(ClientRepositoryFactory.java:95)
... 9 more
java.rmi.RemoteException: Malformed URL: jnp://localhost:1099/jcrServer;
nested exception is:
java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099/jcrServer
at
org.apache.jackrabbit.rmi.client.ClientRepositoryFactory$1.getRemoteRepository(ClientRepositoryFactory.java:97)
at
org.apache.jackrabbit.rmi.client.SafeClientRepository.remoteLogin(SafeClientRepository.java:108)
at
org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:120)
at
org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:136)
at MyConn.main(MyConn.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099/jcrServer
at java.rmi.Naming.intParseURL(Naming.java:273)
at java.rmi.Naming.parseURL(Naming.java:220)
at java.rmi.Naming.lookup(Naming.java:79)
at
org.apache.jackrabbit.rmi.client.ClientRepositoryFactory$1.getRemoteRepository(ClientRepositoryFactory.java:95)
... 9 more


On Thu, Apr 7, 2011 at 9:34 AM, Jukka Zitting <jz...@adobe.com> wrote:

> Hi,
>
>
> On 04/07/2011 12:24 AM, Paulo Silva wrote:
>
>> I have jackrabbit-jca-1.5.5.rar
>>
>
> Any reason why you are not using a more recent Jackrabbit version? The 1.5
> branch dates back to 2008!
>
>
>  But now I have a problem: how can I connect to that repository via
>> RMI? Does someone have a code example / tutorial I can follow?
>>
>
> See the "Accessing a remote repository" section on
> http://jackrabbit.apache.org/jackrabbit-jcr-rmi.html
>
> --
> Jukka Zitting
>

Re: Code example to connect to repository via RMI?

Posted by Jukka Zitting <jz...@adobe.com>.
Hi,

On 04/07/2011 12:24 AM, Paulo Silva wrote:
> I have jackrabbit-jca-1.5.5.rar

Any reason why you are not using a more recent Jackrabbit version? The 
1.5 branch dates back to 2008!

> But now I have a problem: how can I connect to that repository via
> RMI? Does someone have a code example / tutorial I can follow?

See the "Accessing a remote repository" section on 
http://jackrabbit.apache.org/jackrabbit-jcr-rmi.html

-- 
Jukka Zitting

Code example to connect to repository via RMI?

Posted by Paulo Silva <al...@gmail.com>.
Hi,

I have jackrabbit-jca-1.5.5.rar deployed in jboss 4.2.3GA and now I'm trying
to expose via RMI to connect to it via the GUI tool JCR-Controller v0.72.

I followed the instructions to expose RMI here:
http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss

I checked the jmx-console and it seems that the RMI is exposed correctly.

But now I have a problem: how can I connect to that repository via RMI? Does
someone have a code example / tutorial I can follow?


I tried many things with no luck, for example, if I try to put the url
"jnp://localhost:1099/jcrServer" in the JCR-Controller app, I get this
exception:
org.apache.jackrabbit.rmi.client.RemoteRepositoryException: Malformed URL:
jnp:/
/localhost:1099/jcrServer; nested exception is:
        java.net.MalformedURLException: invalid URL scheme:
jnp://localhost:1099
/jcrServer: Malformed URL: jnp://localhost:1099/jcrServer; nested exception
is:



So, anyone can show me how to connect to that server?