This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes rmi and Tomcat  5.5  - java.net. 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "rmi and Tomcat  5.5  - java.net. Malformed URLException: no protocol: Files" Watch "rmi and Tomcat  5.5  - java.net. Malformed URLException: no protocol: Files" New topic
Author

rmi and Tomcat 5.5 - java.net. Malformed URLException: no protocol: Files

jonas tegman
Greenhorn

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:
java.net.MalformedURLException: 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(TestRmiClient.java:42)
at com.deucemedia.common.rmi.TestRmiClient.<clinit>(TestRmiClient.java:19)
Caused by: java.net.MalformedURLException: no protocol: Files
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<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 java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 4 more


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


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.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.rmi.registry.RegistryContextFactory");

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

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:
java.net.MalformedURLException: 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)
com.deucemedia.common.rmi.RmiExecuteUtilServer.init(RmiExecuteUtilServer.java:50)
com.deucemedia.common.rmi.RmiExecuteUtilServer.<init>(RmiExecuteUtilServer.java:32)
com.deucemedia.common.init.Initialize.<init>(Initialize.java:175)
com.deucemedia.common.init.Initialize.<clinit>(Initialize.java:80)
init.InitServlet.initialize(InitServlet.java:67)
init.InitServlet.<clinit>(InitServlet.java:24)
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)
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1055)
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
org.apache.catalina.core.StandardService.start(StandardService.java:450)
org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
org.apache.catalina.startup.Catalina.start(Catalina.java:551)
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)
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

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.
Sun


Ed's latest article: A Java Parallel Calamity http://coopsoft.com/ar/Calamity2Article.html
jonas tegman
Greenhorn

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
Greenhorn

Joined: Aug 29, 2007
Posts: 5
Problem solved... I changed the tomcat installation directory so it didn't have any spaces in it. /J
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: rmi and Tomcat 5.5 - java.net. Malformed URLException: no protocol: Files
 
Similar Threads
very urgent->plz help:error when connecting to cmp
loading RMI class (Stub's) for client using cobebase
Applets and RMI
NX: no permision or no stub use rmi? SOS SOS
Open JMS and Tomcat :Connection