dcsimg
RMI & tomcat 5.5 - Caused by: java.net.MalformedURLException: no protocol: Files
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jonas_tegman
Posted On:   Wednesday, August 29, 2007 11:30 AM

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 (same code) 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.ja   More>>

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 (same code) 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. (TestRmiClient.java:19)
Caused by: java.net.MalformedURLException: no protocol: Files
at java.net.URL. (Unknown Source)
at java.net.URL. (Unknown Source)
at java.net.URL. (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. (RmiExecuteUtilServer.java:32)
com.deucemedia.common.init.Initialize. (Initialize.java:175)
com.deucemedia.common.init.Initialize. (Initialize.java:80)
init.InitServlet.initialize(InitServlet.java:67)
init.InitServlet. (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

   <<Less

Re: RMI & tomcat 5.5 - Caused by: java.net.MalformedURLException: no protocol: Files

Posted By:   jonas_tegman  
Posted On:   Thursday, August 30, 2007 04:28 AM

I changed the tomcat installation directory so it didn't have any spaces in it. Works fine now.

Re: RMI & tomcat 5.5 - Caused by: java.net.MalformedURLException: no protocol: Files

Posted By:   jonas_tegman  
Posted On:   Thursday, August 30, 2007 02:59 AM

also posted on JavaRanch Big Moose Saloon and sun
About | Sitemap | Contact