Hi All I am trying a simple RMI application.I created a package like example.hello and under this i had written Hello.java,HelloImpl.java,HelloClient.java I compiled all these classes. I am trying to rmic to generate skeliton and stub classes. i have c:\ as my current directory and i am using the following command C:\>rmic -classpath c:\examples\hello\ HelloImpl its giving the following error error: File c:\examples\hello\HelloImpl.class does not contain type HelloImpl as expected, but type examples.hello.HelloImpl. Please remove the file, or make su re it appears in the correct subdirectory of the class path. error: Class HelloImpl not found. 2 errors Please suggest me how to go. Regards Radha
Hi again, The answer to this question is pretty much the same as my answer to your last question, a short time ago: you're telling rmic to compile a class "HelloImpl" when in fact you want it to compile examples.rmic.HelloImpl. Again, the answer: don't set the classpath or use the classpath switch. From c:\ just type "rmic examples.hello.HelloImpl" .
Well, you've probably still got the CLASSPATH variable set from the last time -- you need to unset it, or at least make sure it includes ".", the current directory, and does not include examples/hello. Of course, I'm assuming that examples/hello/HelloImpl.class exists, because you compiled it before.
Joined: Mar 28, 2003
Hi Ernest Sorry.my classpath does not include ".". Now i am able to compile it. i am new to this RMI.Can you please let me know how to go form here. i started rmi registry. then i tried to run HelloImpl but its giving the following erro. Can ypu please let me know any good tutorial avilable. HelloImpl err: access denied (java.net.SocketPermission myhost resolve) java.security.AccessControlException: access denied (java.net.SocketPermission m yhost resolve) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkConnect(Unknown Source) at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getByName(Unknown Source) at java.net.Socket.<init>(Unknown Source) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S ource) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S ource) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.newCall(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source) at java.rmi.Naming.rebind(Unknown Source) at examples.hello.HelloImpl.main(HelloImpl.java:29)
author and iconoclast
The tutorial at http://java.sun.com/docs/books/tutorial/rmi/index.html is perfectly nice. You're pretty much all the way there except for the necessary security policy stuff, which is covered under the last page of this tutorial "Running the Example Programs." What you'll need to do is create a java.policy file, as directed, and install it properly. A shortcut (note that you shouldn't do this in production, but if you just want to get things running quickly, and then go back and deal with security later!) is to comment out the lines that set the RMISecturityManager. If you were to comment out those two lines, recompile and re-rmic your classes, you'd find that your program should work fine!