felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From teemu kanstren <tkanst...@gmail.com>
Subject Re: Problem getting the RMI client to work within Felix
Date Thu, 07 Apr 2011 06:09:18 GMT
It is a long time since I did anything with RMI. But I see your client
successfully calls the server, which tries to return to you the instance
of com.notehive.osgi.rubis.hibernate_osgi_rubis.web.browsereg.IServletRemote,
and the client fails to create an object of this class since it can not
access the class file. Is the package
"com.notehive.osgi.rubis.hibernate_osgi_rubis.web.browsereg" visible on your
client side? You also seem to be running some form of middleware
(ch.ethz.iks.r_osgi.imp)
that does reflection. So I guess it could be anywhere down that line that
the OSGI classloader tricks you, when the middleware/RMI picks a wrong
classloader to use for reflection.Just guessing.

2011/4/6 Nima Kaviani <nimak@ece.ubc.ca>

> Hi all,
>
> I am trying to write an RMI client bundle on top of Felix to lookup and
> import an object from an RMI registry; but my efforts fail with the
> following error:
>
> java.rmi.UnmarshalException: error unmarshalling return; nested exception
> is:
>    java.lang.
> ClassNotFoundException:
> com.notehive.osgi.rubis.hibernate_osgi_rubis.web.browsereg.IServletRemote
> (no security manager: RMI class loader disabled)
>    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
>    at
>
> com.notehive.osgi.rubis.hibernate_osgi_rubis.web.core.SpringHttpWrapperImpl.register(SpringHttpWrapperImpl.java:102)
>    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
>
> ch.ethz.iks.r_osgi.impl.ChannelEndpointImpl.handleMessage(ChannelEndpointImpl.java:1140)
>    at
>
> ch.ethz.iks.r_osgi.impl.ChannelEndpointImpl$2.run(ChannelEndpointImpl.java:295)
>    at
>
> ch.ethz.iks.r_osgi.impl.ChannelEndpointImpl$1.run(ChannelEndpointImpl.java:258)
> Caused by: java.lang.ClassNotFoundException:
> com.notehive.osgi.rubis.hibernate_osgi_rubis.web.browsereg.IServletRemote
> (no security manager: RMI class loader disabled)
>    at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:535)
>    at
> java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
>    at
> java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)
>    at
>
> sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
>    at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1530)
>    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1492)
>    at
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
>    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
>    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
>    ... 9 more
>
> I am not sure if this is due to a classloading problem or a java security
> issue.
>
> For class loading I am using utilities from Pax Swissbox Core combined with
> parts of Pax Exam's client code:
>
>        if( _remoteServlet == null )
>        {
>            Throwable reason = null;
>            long startedTrying = System.currentTimeMillis();
>           try {
>                ContextClassLoaderUtils.doWithClassLoader(null, new
> Callable<Object>() {
>                       public Object call() throws Exception {
>                            try  {
>                                _registry = LocateRegistry.getRegistry(
> SpringHttpWrapperImpl.PORT );
>                            }catch(Exception e){
>                                e.printStackTrace();
>                            }
>                            return null;
>                       }
>                   });
>            } catch (Exception e1) {
>                e1.printStackTrace();
>            }
>           try
>           {
>               _remoteServlet =
>                   (IServletRemote) _registry.lookup(
> SpringHttpWrapperImpl.STUB_NAME );
>               while( _remoteServlet == null
>                      && System.currentTimeMillis() < startedTrying + 1000
> );
>           } catch( ConnectException e ) {
>               reason = e;
>           } catch( NotBoundException e ) {
>               reason = e;
>           } catch( RemoteException e ) {
>               reason = e;
>           }
>           if( _remoteServlet == null )
>                reason.printStackTrace();
>        }
>
> I also have Felix Security Framework in place and the following policy file
> configured.
>
> grant {
>    permission java.security.AllPermission;
> };
>
> The part that triggers the error is the code below where I try to lookup
> for
> the class from the RMI registry:
>
> _remoteServlet = (IServletRemote) _registry.lookup(
> SpringHttpWrapperImpl.STUB_NAME );
>
> very much would appreciate any hints on what could be wrong.
> -Nima
>
>
> --
> http://nima.magic.ubc.ca
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message