• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
jonas tegman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry... this problem is posted on jguru ans sun also.
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
jonas tegman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem solved... I changed the tomcat installation directory so it didn't have any spaces in it. /J
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic