• 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

NX:RMI exception

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i run client by Remote Mode
i get exception:
java.security.AccessControlException: access denied (java.net.SocketPermission f
enet-steven 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.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Steven
Have you coded a SecurityManager into your application? If so, then you probably want to get rid of it. This error usually occurs when you have a line in your code like:
You do not need (or want) a security manager for any of the assignments, and in the new assignments it is explitly stated that you should not have a security manager.
If that hasnt fixed your problem, then what are you using for hostname and socket number? I suggest you go with "localhost" and the standard socket number to get things working.
By the way, we like to see a last name in the displayed name. This is described in the JavaRanch naming policy. Could you please update your displayed name to show this? You can change it here.
Regards, Andrew
 
guyue0505
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks , now i get rid of the code of
"System.setSecurityManager(new RMISecurityManager());"
but when i run i get new exception like this :
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: suncertify.server.RemoteData_Stub (no
security manager: RMI class loader disabled)
java.lang.ClassNotFoundException: suncertify.server.RemoteData_Stub (no security
manager: RMI class loader disabled)
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)
by the way ,because i put the remote interface named remoteData in the <db> package , and put
the class named remoteDBAccess which implemented
remoteData in the server package.
how can i put the RemoteData_Stub.class into the
client package?
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steven
Could you please put a first and last name into your displayed name, as described in the JavaRanch naming policy? You can change it here.
I have put a note in this thread stating that it is a duplicate, and should be closed. If you disagree, please post a comment in that thread stating what the differences are, and why it should stay open.

how can i put the RemoteData_Stub.class into the client package?


All you need to do is ensure that suncertify.server.RemoteData_Stub.class is in the client package (note: the directory structure needs to be there as well).
Try that, and see if your exceptions disapear.
Regards, Andrew
 
guyue0505
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks first
my question is how can i put the RemoteData_Stub.class into the
client package?
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steven
I think I need to clarify what you mean by "client package". When I first read your email, I assumed you were talking about creating a package to distribute to clients. In this reference, I was reading "jar file" instead of "package".
But I realise that I am almost certainly wrong: you are using the term package in the same way that Sun use it: to describe the directory structure for the classes.
So RemoteData (and therefore RemoteData_stub) are in the suncertify.server package, and this is where they belong.
Assuming you have a directory structure like:

Then as long as you start your application with java -cp classes .... the client should be able to find the stub file.
(Change the example directory structure to suit your layout of course).
Likewise, when you package it all into an executable jar file, the client code will be in the same jar as the stub file, so it will be able to find it.
Regards, Andrew
 
reply
    Bookmark Topic Watch Topic
  • New Topic