• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in using rmic

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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" .
 
Radha MahaLakshmi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i tried compiling from c:\
as rmic examples.hello.HelloImpl
its giving the following error
C:\>rmic examples.hello.HelloImpl
error: Class examples.hello.HelloImpl not found.
1 error
Regards
Radha
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Radha MahaLakshmi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm moving this fancy talk to The Intermediate Forum...
 
reply
    Bookmark Topic Watch Topic
  • New Topic