Improperly encoded URLs

"Humphreys, Brett" <[email protected]> Wed, 20 Jun 2007 16:06:59 -0400
Newsgroups gmane.comp.java.sun.rmi
Message-ID <C0170D0AF1277849A4B4518034F855DD02C65314@aiexchange.ai.aiinet.com>
All,
I'm using RMI in an OSGi runtime (more specifically equinox).  Further
according to http://java.sun.com/j2se/1.5.0/docs/guide/rmi/codebase.html
I'm using it in a similar way to Figure 4.  Where my client is calling a
remote object instance and is passing an unknown subtype (unknown to the
server) as a method parameter.
 
Once I make this call I receive a pretty standard MalformedURLException:
 
java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is: 
 java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is: 
 java.net.MalformedURLException: no protocol: and
 at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
 at sun.rmi.transport.Transport$1.run(Transport.java:153)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
 at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
 at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
va:701)
 at java.lang.Thread.run(Thread.java:595)
 at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
 at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
 at sun.rmi.server.UnicastRef.invoke(Unknown Source)
 at
java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown
Source)
 at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
 at $Proxy3.registerAccessibilityListener(Unknown Source)
 at
com.aiinet.director.client.DirectorClientServices.setupInitialInventory(
DirectorClientServices.java:617)
 at
com.aiinet.director.client.DirectorClientServices.completeLogin(Director
ClientServices.java:266)
 at
com.aiinet.director.client.DirectorClientServices.startSession(DirectorC
lientServices.java:206)
 at
com.aiinet.director.client.DirectorClient.startSession(DirectorClient.ja
va:64)
 at
com.aiinet.director.client.boot.ClientBoot.attemptLogin(ClientBoot.java:
569)
 at
com.aiinet.director.client.boot.LoginDialog$1.run(LoginDialog.java:199)
 
 
As you probably have already deduced, some of my jars are referenced
from 'C:\Documents and Settings'.  I've ethereal'd the stream going from
client to server and it does seem that all the jars that are loaded into
the OSGi runtime (as bundles) are improperly URL encoded (I believe this
is from calls to File.toURL() instead of File.toURI().toURL()).  
 
Obviously the correct solution is to fix the OSGi implementation to hand
back properly encoded file:// urls.  However I'm not sure what exactly
needs fixing (past fixing every call to toURL(), which I'm trying to
avoid).  My question is:
 
It seems that sun.rmi.server.UnicastRef.invoke produces this list of
space separated jar URLs (figure 4, step 7 in the referenced document)
that are sent to the server and parsed.  I'm curious how this list is
produced.  Is every classloader in the VM queried for jar locations it
has loaded?  If the java.rmi.server.codebase property isn't set, how is
this list calculated?  
 
Further setting java.rmi.server.codebase property (on the client, who is
making the call) doesn't seem to have much affect on this behavior.  At
least with respect to the list of jars that are sent to the server.  But
according to the documentation, I expected it to have some affect on
this behavior.
 
Any help and guidance would be appreciated.

Thanks
-Brett
 
 
--
Brett Humphreys
Senior Software Engineer
Applied Innovation
Office: 614-923-1340
Fax:    614-798-1770
 

===========================================================================
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