This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I am reading Thinking in enterprise java, the RMI chapter, and I write a demo to test RMI, here is my code:
it doesn't work ,and the exception is :java.security.AccessControlException: access denied (java.net.SocketPermission HIWAY resolve), when I comment this line: System.setSecurityManager(new RMISecurityManager()); it works well, but at page 42 of Thinking in enterprise java, it said:
When you’re serving
RMI objects, at some point in your program you must:
• Create and install a security manager that supports RMI. The only one
available for RMI as part of the Java distribution is RMISecurityManager.
Question 2: at page 42 ,it said :
1. localhost does not work with RMI. Thus, to experiment with RMI on a single
machine, you must provide the name of the machine. To find out the name of
your machine under 32-bit Windows, go to the control panel and select
“Network.” Select the “Identification” tab, and you’ll see your computer name. In
my case, I called my computer “Peppy.” It appears that capitalization is ignored.
2. RMI will not work unless your computer has an active TCP/IP connection, even
if all your components are just talking to each other on the local machine. This
means that you must connect to your Internet service provider before trying to
run the program or you’ll get some obscure exception messages.
it means I must connect to internet to test RMI, but if I use "localhost" at the end of code: Naming.rebind("rmi://localhost:8090/hello", hello); it also works well ,so why ?