You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Christian Stocker <me...@chregu.tv> on 2008/11/19 10:03:11 UTC

Short RMI Question

Hi

I'm trying to get into Jackrabbit and already fail and hope someone can
give me some hints. I'm trying to set up an RMI Server and use the code
from the section "Simple Standalone RMI Server / Client"

http://wiki.apache.org/jackrabbit/ExamplesPage

My actual code looks like this

http://pastie.org/318554

The server starts correctly and if I run SecondHop.java for the first
time, that does the job, too. But if I run that a second time, I get an
Exception (see below). If I restart the rmiserver, it works again once.

I saw that others have similar problems, but I couldn't figure out how
to solve the problem, since the solution usually was "switch to rmi" and
I'm not very confident in the java world in general:)

Any help would be really appreciated

chregu

***
The Exception
***
Exception in thread "main" javax.jcr.RepositoryException: Directory was
previously created with a different LockFactory instance; please pass
null as the lockFactory instance and use setLockFactory to change it:
Directory was previously created with a different LockFactory instance;
please pass null as the lockFactory instance and use setLockFactory to
change it
        at
org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:136)
        at
org.apache.jackrabbit.rmi.server.ServerRepository.login(ServerRepository.java:107)
        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
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
        at sun.rmi.transport.Transport$1.run(Transport.java:159)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
        at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
        at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
        at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
        at
org.apache.jackrabbit.rmi.server.ServerRepository_Stub.login(Unknown Source)
        at
org.apache.jackrabbit.rmi.client.SafeClientRepository.remoteLogin(SafeClientRepository.java:105)
        at
org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:120)
        at
org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:131)
        at SecondHop.main(SecondHop.java:21)



Re: Short RMI Question

Posted by Christian Stocker <me...@chregu.tv>.
Hi Felix

On 19.11.2008 10:10 Uhr, Felix Meschberger wrote:
> Hi Christian,
> 
> Could it be that the the server sided TransientRepository is kind of
> shutting down when you logout the first time and cannot connect you for
> the second time ?

Thanks for the hint, I for now just added

remote.login();

after

reg.rebind("jackrabbit", remote);

and that does the job. I just need it for testing, the proper solution
can wait :)

chregu

> 
> Maybe using a full fledged Repository setup with RepositoryConfig would
> help.
> 
> Regards
> Felix
> 
> Christian Stocker schrieb:
>> Hi
>>
>> I'm trying to get into Jackrabbit and already fail and hope someone can
>> give me some hints. I'm trying to set up an RMI Server and use the code
>> from the section "Simple Standalone RMI Server / Client"
>>
>> http://wiki.apache.org/jackrabbit/ExamplesPage
>>
>> My actual code looks like this
>>
>> http://pastie.org/318554
>>
>> The server starts correctly and if I run SecondHop.java for the first
>> time, that does the job, too. But if I run that a second time, I get an
>> Exception (see below). If I restart the rmiserver, it works again once.
>>
>> I saw that others have similar problems, but I couldn't figure out how
>> to solve the problem, since the solution usually was "switch to rmi" and
>> I'm not very confident in the java world in general:)
>>
>> Any help would be really appreciated
>>
>> chregu
>>
>> ***
>> The Exception
>> ***
>> Exception in thread "main" javax.jcr.RepositoryException: Directory was
>> previously created with a different LockFactory instance; please pass
>> null as the lockFactory instance and use setLockFactory to change it:
>> Directory was previously created with a different LockFactory instance;
>> please pass null as the lockFactory instance and use setLockFactory to
>> change it
>>         at
>> org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:136)
>>         at
>> org.apache.jackrabbit.rmi.server.ServerRepository.login(ServerRepository.java:107)
>>         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
>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>         at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>         at
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>         at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>         at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>         at java.lang.Thread.run(Thread.java:619)
>>         at
>> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
>>         at
>> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
>>         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
>>         at
>> org.apache.jackrabbit.rmi.server.ServerRepository_Stub.login(Unknown Source)
>>         at
>> org.apache.jackrabbit.rmi.client.SafeClientRepository.remoteLogin(SafeClientRepository.java:105)
>>         at
>> org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:120)
>>         at
>> org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:131)
>>         at SecondHop.main(SecondHop.java:21)
>>
>>
>>

-- 
Christian Stocker   -   me@chregu.tv
Friesenbergstrasse 135 - 8055 Zurich
+41 76 561 88 60 - http://chregu.tv/

Re: Short RMI Question

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Christian,

Could it be that the the server sided TransientRepository is kind of
shutting down when you logout the first time and cannot connect you for
the second time ?

Maybe using a full fledged Repository setup with RepositoryConfig would
help.

Regards
Felix

Christian Stocker schrieb:
> Hi
> 
> I'm trying to get into Jackrabbit and already fail and hope someone can
> give me some hints. I'm trying to set up an RMI Server and use the code
> from the section "Simple Standalone RMI Server / Client"
> 
> http://wiki.apache.org/jackrabbit/ExamplesPage
> 
> My actual code looks like this
> 
> http://pastie.org/318554
> 
> The server starts correctly and if I run SecondHop.java for the first
> time, that does the job, too. But if I run that a second time, I get an
> Exception (see below). If I restart the rmiserver, it works again once.
> 
> I saw that others have similar problems, but I couldn't figure out how
> to solve the problem, since the solution usually was "switch to rmi" and
> I'm not very confident in the java world in general:)
> 
> Any help would be really appreciated
> 
> chregu
> 
> ***
> The Exception
> ***
> Exception in thread "main" javax.jcr.RepositoryException: Directory was
> previously created with a different LockFactory instance; please pass
> null as the lockFactory instance and use setLockFactory to change it:
> Directory was previously created with a different LockFactory instance;
> please pass null as the lockFactory instance and use setLockFactory to
> change it
>         at
> org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:136)
>         at
> org.apache.jackrabbit.rmi.server.ServerRepository.login(ServerRepository.java:107)
>         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
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>         at sun.rmi.transport.Transport$1.run(Transport.java:159)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>         at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>         at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>         at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:619)
>         at
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
>         at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
>         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
>         at
> org.apache.jackrabbit.rmi.server.ServerRepository_Stub.login(Unknown Source)
>         at
> org.apache.jackrabbit.rmi.client.SafeClientRepository.remoteLogin(SafeClientRepository.java:105)
>         at
> org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:120)
>         at
> org.apache.jackrabbit.rmi.client.SafeClientRepository.login(SafeClientRepository.java:131)
>         at SecondHop.main(SecondHop.java:21)
> 
> 
>