Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to use RMI with Equinox
How to use RMI with Equinox [message #101029] Mon, 05 November 2007 15:37 Go to next message
Mickael GAUVIN is currently offline Mickael GAUVIN
Messages: 38
Registered: July 2009
Member
Hello world,

I have a problem in using the RMI method "rebind" in the start method
of my bundle. I have this source code :

// ---------------------------------------------------------
IMyObject myObject = new MyObject();
SecurityManager securityManager = null;
securityManager = new RMISecurityManager();
System.setSecurityManager(securityManager);
LocateRegistry.createRegistry(9090);
Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
// ----------------------------------------------------------

This code works well in a normal Java Project and I have configured the
java.policy file with :

grant {
permission java.security.AllPermission;
};

But in the equinox environment an Exception is thrown :

// -----------------------------------------------------------
java.security.PrivilegedActionException: java.rmi.ServerException:
RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException:
fr.itcs.exec.service.distinfra.rmi.IMyObject
// -----------------------------------------------------------

If anyone has encountered this problem, I will be pleased to hear his
solution. (May be a ClassLoader problem ?)

Mickael.
Re: How to use RMI with Equinox [message #101115 is a reply to message #101029] Mon, 05 November 2007 21:49 Go to previous messageGo to next message
Jaime is currently offline Jaime
Messages: 56
Registered: July 2009
Member
Hi Mickael,

I suffer the same problem than you.
If you have the chance, replace:

LocateRegistry.createRegistry(9090);
Naming.rebind("rmi://localhost:9090/testMyObject", myObject);

by:

Registry registry = LocateRegistry.createRegistry(9090);
registry.rebind("testMyObject", myObject);

You shouldn't have any problem with this code.

BR,
Jaime
"Mickael Gauvin" <mickael.gauvin@gmail.com> escribi
Re: How to use RMI with Equinox [message #101621 is a reply to message #101115] Tue, 20 November 2007 08:08 Go to previous messageGo to next message
Mickael GAUVIN is currently offline Mickael GAUVIN
Messages: 38
Registered: July 2009
Member
Thank you,

It works. The problem is that the RMI Naming class is loaded by the
System Class Loader and not by my bundle class loader. For the Registry
class it is different because it is my bundle who creates it.

Thanks.

Mickael.

Jaime a écrit :
> Hi Mickael,
>
> I suffer the same problem than you.
> If you have the chance, replace:
>
> LocateRegistry.createRegistry(9090);
> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>
> by:
>
> Registry registry = LocateRegistry.createRegistry(9090);
> registry.rebind("testMyObject", myObject);
>
> You shouldn't have any problem with this code.
>
> BR,
> Jaime
> "Mickael Gauvin" <mickael.gauvin@gmail.com> escribió en el mensaje
> news:fgndaf$fsa$1@build.eclipse.org...
>> Hello world,
>>
>> I have a problem in using the RMI method "rebind" in the start method
>> of my bundle. I have this source code :
>>
>> // ---------------------------------------------------------
>> IMyObject myObject = new MyObject();
>> SecurityManager securityManager = null;
>> securityManager = new RMISecurityManager();
>> System.setSecurityManager(securityManager);
>> LocateRegistry.createRegistry(9090);
>> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>> // ----------------------------------------------------------
>>
>> This code works well in a normal Java Project and I have configured the
>> java.policy file with :
>>
>> grant {
>> permission java.security.AllPermission;
>> };
>>
>> But in the equinox environment an Exception is thrown :
>>
>> // -----------------------------------------------------------
>> java.security.PrivilegedActionException: java.rmi.ServerException:
>> RemoteException occurred in server thread; nested exception is:
>> java.rmi.UnmarshalException: error unmarshalling arguments; nested
>> exception is:
>> java.lang.ClassNotFoundException:
>> fr.itcs.exec.service.distinfra.rmi.IMyObject
>> // -----------------------------------------------------------
>>
>> If anyone has encountered this problem, I will be pleased to hear his
>> solution. (May be a ClassLoader problem ?)
>>
>> Mickael.
>
>
Re: How to use RMI with Equinox [message #101630 is a reply to message #101115] Tue, 20 November 2007 08:11 Go to previous messageGo to next message
Mickael GAUVIN is currently offline Mickael GAUVIN
Messages: 38
Registered: July 2009
Member
Thank you,

It works. The problem is that the RMI Naming class is loaded by the
System Class Loader and not by my bundle class loader. For the Registry
class it is different because it is my bundle who creates it.

Thanks.

Mickael.

Jaime a écrit :
> Hi Mickael,
>
> I suffer the same problem than you.
> If you have the chance, replace:
>
> LocateRegistry.createRegistry(9090);
> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>
> by:
>
> Registry registry = LocateRegistry.createRegistry(9090);
> registry.rebind("testMyObject", myObject);
>
> You shouldn't have any problem with this code.
>
> BR,
> Jaime
> "Mickael Gauvin" <mickael.gauvin@gmail.com> escribió en el mensaje
> news:fgndaf$fsa$1@build.eclipse.org...
>> Hello world,
>>
>> I have a problem in using the RMI method "rebind" in the start method
>> of my bundle. I have this source code :
>>
>> // ---------------------------------------------------------
>> IMyObject myObject = new MyObject();
>> SecurityManager securityManager = null;
>> securityManager = new RMISecurityManager();
>> System.setSecurityManager(securityManager);
>> LocateRegistry.createRegistry(9090);
>> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>> // ----------------------------------------------------------
>>
>> This code works well in a normal Java Project and I have configured the
>> java.policy file with :
>>
>> grant {
>> permission java.security.AllPermission;
>> };
>>
>> But in the equinox environment an Exception is thrown :
>>
>> // -----------------------------------------------------------
>> java.security.PrivilegedActionException: java.rmi.ServerException:
>> RemoteException occurred in server thread; nested exception is:
>> java.rmi.UnmarshalException: error unmarshalling arguments; nested
>> exception is:
>> java.lang.ClassNotFoundException:
>> fr.itcs.exec.service.distinfra.rmi.IMyObject
>> // -----------------------------------------------------------
>>
>> If anyone has encountered this problem, I will be pleased to hear his
>> solution. (May be a ClassLoader problem ?)
>>
>> Mickael.
>
>
Re: How to use RMI with Equinox [message #101643 is a reply to message #101115] Tue, 20 November 2007 08:12 Go to previous messageGo to next message
Mickael GAUVIN is currently offline Mickael GAUVIN
Messages: 38
Registered: July 2009
Member
Thank you,

It works. The problem is that the RMI Naming class is loaded by the
System Class Loader and not by my bundle class loader. For the Registry
class it is different because it is my bundle who creates it.

Thanks.

Mickael.

Jaime a écrit :
> Hi Mickael,
>
> I suffer the same problem than you.
> If you have the chance, replace:
>
> LocateRegistry.createRegistry(9090);
> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>
> by:
>
> Registry registry = LocateRegistry.createRegistry(9090);
> registry.rebind("testMyObject", myObject);
>
> You shouldn't have any problem with this code.
>
> BR,
> Jaime
> "Mickael Gauvin" <mickael.gauvin@gmail.com> escribió en el mensaje
> news:fgndaf$fsa$1@build.eclipse.org...
>> Hello world,
>>
>> I have a problem in using the RMI method "rebind" in the start method
>> of my bundle. I have this source code :
>>
>> // ---------------------------------------------------------
>> IMyObject myObject = new MyObject();
>> SecurityManager securityManager = null;
>> securityManager = new RMISecurityManager();
>> System.setSecurityManager(securityManager);
>> LocateRegistry.createRegistry(9090);
>> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>> // ----------------------------------------------------------
>>
>> This code works well in a normal Java Project and I have configured the
>> java.policy file with :
>>
>> grant {
>> permission java.security.AllPermission;
>> };
>>
>> But in the equinox environment an Exception is thrown :
>>
>> // -----------------------------------------------------------
>> java.security.PrivilegedActionException: java.rmi.ServerException:
>> RemoteException occurred in server thread; nested exception is:
>> java.rmi.UnmarshalException: error unmarshalling arguments; nested
>> exception is:
>> java.lang.ClassNotFoundException:
>> fr.itcs.exec.service.distinfra.rmi.IMyObject
>> // -----------------------------------------------------------
>>
>> If anyone has encountered this problem, I will be pleased to hear his
>> solution. (May be a ClassLoader problem ?)
>>
>> Mickael.
>
>
Re: How to use RMI with Equinox [message #108966 is a reply to message #101630] Tue, 29 April 2008 20:03 Go to previous message
Eclipse User
Originally posted by: wesendon.in.tum.de

Hi,

I have a simillar Problem, but still didn't manage to get the RMI
running. How do you solve this class loader issue? Maybe you have a idea?

The server code:
public class RMITest{

public RMITest() throws RemoteException, MalformedURLException {
System.setSecurityManager(new RMISecurityManager());
LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
RemoteServer.setLog(System.out);

FacadeTest stub = (FacadeTest) UnicastRemoteObject.exportObject(new
FacadeTestImpl(), 0);

Registry registry = LocateRegistry.getRegistry();
registry.rebind("FacadeTest", stub);
}
}

The Exception:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException: org.unicase.emfstore.rmi.FacadeTest
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)


Regards.

Mickael Gauvin schrieb:
> Thank you,
>
> It works. The problem is that the RMI Naming class is loaded by the
> System Class Loader and not by my bundle class loader. For the Registry
> class it is different because it is my bundle who creates it.
>
> Thanks.
>
> Mickael.
>
> Jaime a écrit :
>> Hi Mickael,
>>
>> I suffer the same problem than you.
>> If you have the chance, replace:
>>
>> LocateRegistry.createRegistry(9090);
>> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>>
>> by:
>>
>> Registry registry = LocateRegistry.createRegistry(9090);
>> registry.rebind("testMyObject", myObject);
>>
>> You shouldn't have any problem with this code.
>>
>> BR,
>> Jaime
>> "Mickael Gauvin" <mickael.gauvin@gmail.com> escribió en el mensaje
>> news:fgndaf$fsa$1@build.eclipse.org...
>>> Hello world,
>>>
>>> I have a problem in using the RMI method "rebind" in the start method
>>> of my bundle. I have this source code :
>>>
>>> // ---------------------------------------------------------
>>> IMyObject myObject = new MyObject();
>>> SecurityManager securityManager = null;
>>> securityManager = new RMISecurityManager();
>>> System.setSecurityManager(securityManager);
>>> LocateRegistry.createRegistry(9090);
>>> Naming.rebind("rmi://localhost:9090/testMyObject", myObject);
>>> // ----------------------------------------------------------
>>>
>>> This code works well in a normal Java Project and I have configured the
>>> java.policy file with :
>>>
>>> grant {
>>> permission java.security.AllPermission;
>>> };
>>>
>>> But in the equinox environment an Exception is thrown :
>>>
>>> // -----------------------------------------------------------
>>> java.security.PrivilegedActionException: java.rmi.ServerException:
>>> RemoteException occurred in server thread; nested exception is:
>>> java.rmi.UnmarshalException: error unmarshalling arguments; nested
>>> exception is:
>>> java.lang.ClassNotFoundException:
>>> fr.itcs.exec.service.distinfra.rmi.IMyObject
>>> // -----------------------------------------------------------
>>>
>>> If anyone has encountered this problem, I will be pleased to hear his
>>> solution. (May be a ClassLoader problem ?)
>>>
>>> Mickael.
>>
>>
>
Previous Topic:Is OSGi scaleable
Next Topic:How to package web application as bundles ?
Goto Forum:
  


Current Time: Fri Sep 19 19:49:29 GMT 2014

Powered by FUDForum. Page generated in 0.02398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software