smart/dynamic proxies and java 1.5

"Mark E. Ackerman" <[email protected]> Tue, 3 Oct 2006 10:34:55 -0700
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Anyone out there using RMI Smart Proxies/Dynamic Proxies (Rickard
Oberg posted the way to do this
here a long time ago) with Java 1.5?  (or is there a new better way
to use Dynamic Proxies in 1.5)

We're inserting proxies on both the client and server side to do
stuff, logging, security etc.

We're been using them successfully with Java 1.3 and 1.4 but they no
longer work with 1.5.
I figured I check to see if anyone else has already run into this problem.

We're getting StubNotFoundExceptions.

Exception with exportObject on PortableRmiObject
(//xxx.xxx.xxx.165:64101/)RmiFileManagerImpl[RMAUnicastServerRef2
[liveRef:
[endpoint:[xxx.xxx.xxx.165:52010,rma.rmi.server.SinglePortServerSocketFactory@84eda628,rma.rmi.server.LimitedPortServerSocketFactory@52a393bc](local),objID:[0]]]]
Error:java.rmi.StubNotFoundException: Stub class not found:
$Proxy0_Stub; nested exception is:
java.lang.ClassNotFoundException: $Proxy0_Stub
java.rmi.StubNotFoundException: Stub class not found: $Proxy0_Stub;
nested exception is:
java.lang.ClassNotFoundException: $Proxy0_Stub
         at sun.rmi.server.Util.createStub(Util.java:274)
         at sun.rmi.server.Util.createProxy(Util.java:122)
         at
sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:179)
         at
sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:161)
         at
hec.server.PortableRmiObject.exportObject(PortableRmiObject.java:812)
         at
hec.server.PortableRmiObject.exportObject(PortableRmiObject.java:720)
         at
hec.server.PortableRmiObject.exportServer(PortableRmiObject.java:365)
         at
hec.server.PortableRmiObject.rebindServer(PortableRmiObject.java:228)
         at hec.server.RMIServer.startServer(RMIServer.java:156)
         at hec.server.RMIProxyServer.<init>(RMIProxyServer.java:66)
         at hec.server.FileManager.<init>(FileManager.java:23)
         at hec.server.FileManager.main(FileManager.java:92)
         Caused by: java.lang.ClassNotFoundException: $Proxy0_Stub
                 at java.lang.Class.forName0(Native Method)
                 at java.lang.Class.forName(Class.java:242)
                 at sun.rmi.server.Util.createStub(Util.java:268)

ClassNotFoundException usually means its not in the classpath.  But
with the Smart Proxy stuff
its never been in the classpath.  It gets loaded through the use of a
custom class loader.  My guess
is that how RMI does classloading was changed 1.5, but that's only a guess.

One other option we're considering is moving to Jini, but with the constraints
on getting the release out we don't have time to convert all our
servers to Jini (unless its really
easy to convert RMI Servers to Jini Servers).
.

Thanks
Mark

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html