This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes rmi and Tomcat  5.5  - Malformed URLException: no protocol: Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "rmi and Tomcat  5.5  - Malformed URLException: no protocol: Files" Watch "rmi and Tomcat  5.5  - Malformed URLException: no protocol: Files" New topic

rmi and Tomcat 5.5 - Malformed URLException: no protocol: Files

jonas tegman

Joined: Aug 29, 2007
Posts: 5
Im running tomcat 5.5 on win64 with jdk1.5.0_07.

I have a problem with a simple RMI server/client test. It works fine if I start the server and client via main methods (I can see my port is listening in netstat).

If I start the server via tomcat it seems like everything is ok, but when I run my client I get the following exception on client side lookup:

java.rmi.UnmarshalException: error unmarshalling return; nested exception is: no protocol: Files
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at com.deucemedia.common.rmi.TestRmiClient.init(
at com.deucemedia.common.rmi.TestRmiClient.<clinit>(
Caused by: no protocol: Files
at<init>(Unknown Source)
at<init>(Unknown Source)
at<init>(Unknown Source)
at sun.rmi.server.LoaderHandler.pathToURLs(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at Source)
at Source)
at Source)
at Source)
at Source)
... 4 more

Server code:
private static final int serverPort=20000;
private static final String regLookup="RmiExecuteUtilServer";
Registry registry = LocateRegistry.createRegistry(serverPort);

Client code:
registry=LocateRegistry.getRegistry(serverUrl, Integer.valueOf(serverPort));
rmiServer = (RmiExecuteUtilServerInterface)registry.lookup(regLookup);

Funny enough... If I change my server code to:
Registry registry = LocateRegistry.createRegistry(serverPort);

Hashtable env=new Hashtable();

env.put(Context.PROVIDER_URL, "rmi://"+Initialize.getServerIp()+":"+serverPort);
InitialContext c=new InitialContext(env);

I get similar problem when I start the rmi server via tomcat:

Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: no protocol: Files]][
com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
javax.naming.InitialContext.bind(Unknown Source)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)

Any suggestions?

Thanks. Jonas
Edward Harned
Ranch Hand

Joined: Sep 19, 2005
Posts: 291

If you must post to multiple forums at least let people know so they don't waste time replying to something that was answered elsewhere.

Ed's latest article: A Java Reactive Generator
jonas tegman

Joined: Aug 29, 2007
Posts: 5
sorry... this problem is posted on jguru ans sun also.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Personally, while it's not OK to cross-post to multiple JavaRanch forums, I think it's OK to cross-post to completely different bulletin boards, like JGuru. It is nice to say you've done so, to save others' time.

Sorry, I haven't done RMI for ages (just CORBA), so can't help with your actual problem.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
jonas tegman

Joined: Aug 29, 2007
Posts: 5
Problem solved... I changed the tomcat installation directory so it didn't have any spaces in it. /J
I agree. Here's the link:
subject: rmi and Tomcat 5.5 - Malformed URLException: no protocol: Files
It's not a secret anymore!