• 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

Dynamic stub downloading

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i am trying dynamic stub downloading but getting following error
message when stub gets downloaded..........
------------------------------------------------------------
Exception in thread "main" java.lang.IllegalAccessError: class server_Stub cannot access its superinterface remoteI
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.inputClassDescriptor(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.inputObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at client.main(client.java:16)
------------------------------------------------------------
I had started rmiregistry after setting no classpath.
My server and client files are in seperate directories.
In server directory classpath is current directory only)
---------------------
remoteI.class (interface class)
server.class (main server program)
server_Stub.class
server_Skel.class
policy (policy file having all permission set)
---------------------
in client directory classpath is current directory only)
--------------------------
client.class (client program)
remoteI.class (interface class)
policy (All permissions granted)
--------------------------
---------client.java------------------------
public class client
{
public static void main(String []s)
{
System.setSecurityManager(new RMISecurityManager());
try
{
remoteI _server=(remoteI)Naming.lookup("rmi://"+"192.168.1.78"+"/"+"Test");
System.out.println(_server.getMessage());


}catch(Exception e)
{
e.printStackTrace();
}
}
}
---------------------------------

Now what is the problem.Why downloaded stub is not able to access interface class?
I have already set all permission in the policy file.
please send reply soon
Thanks in advance....
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1> Kill all the previous processes on that port.
2> In order to use RMI in JDK 1.2 and beyond, you would have to create a policy file and specify it on the command-line when you run your class file using command "Java". It is because in order to use RMI, you have to install the RMISecurityManager using the call "System.setSecurityManager(new RMISecurityManager())" and this security manager does not allow socket communications unless you explicitly allow them in the policy file.
3> Check your policy file. Write a simple policy file and see if you are encountering the same exceptions.
Here is a simple policy file:
grant {
permission java.security.AllPermission "", "";
};
Regards,
Milind
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic