|   NetProg 2002 HW7 FAQ |
|     Proj. Desc.     |    Submitting    |    rmiregistry trouble     |    Serializable Exceptions     |     RPC-Howto     |    RMI-Howto |
| Question: | I'm having trouble with the rmiregistry, it won't seem to run! |
|
| Answer: | Chances are that someone else is running it on the
default port. You can run your own copy on whatever port you want
(just specify a port number on the command line), but you need to
include a port number in the rmi URLS in both your client and server
(that you give to There is a complete RMI example that supports having the
registry tun on an alternate port here:
| |
| Question: | I get a runtime error when I call a remote method that creates an object I've defined to hold the components of a URL. The error message says that my class is not "serializable", how do I fix this? |
|
| Answer: | If you want to send (as a parameter) or receive (as
a return value) an object whose class you have defined, your class
must implement the interface "Serializable". Note that unless you
are doing something tricky, you can do this by simply declaring that
the class "implements Serializable", no additional code is
necessary. The interface You can also wait and try again later, or move to a different machine... | |
| Question: | ||
| Answer: |
Step 1: First write and debug a program that can parse and build URLs. Don't worry about RPC until you have this part done. Step 2: Develop a protocol definition file (a
Step 3: Run Step 4: Look at the Step 5: Make a copy of the program you developed in step
1 that will become your client (name it hw7client.c or something
like that). You need to add some RPC
initializtion stuff to the
Note that Step 6: Change the rest of the client program so that it calls the client stubs instead of your actual functions (which you should remove from the client). Step 7: Run Step 8: Build the client, probably something like this: gcc -o client hw7client.c hw7_clnt.c hw7_xdr.c -lnsl Build the server: gcc -DRPC_SVC_FG -o server hw7service.c hw7_svc.c hw7_xdr.c -lrpcsvc -lnsl Note: -DRPC_SVC_FG will force your server to run in the foreground, if you don't add this it will become a daemon (and it will be harder to debug and test). Step 9: Run the server, run the client to test everything. Step 10: Make sure you don't forget to write up detailed instructions on how we should build and test your program. Include a few sample command lines for the client. Submit your project, and start studying for the Netprog comprehensive final exam that will take place every day of finals week from 6AM-9AM in the Gym. Make sure your sneakers are in good shape, you have protective eye gear, and that have bring plenty of GatorAde to bring to the final. This is a joke, there is no
comprehensive final exam, just test #2 on the last day of class
| |
| Question: | ||
| Answer: |
Step 1. Write and debug a Java program (a class with a
Step 2. Create an Step 3. Create a Step 4. Compile your interface (step 2) and class (step
3). Now run Step 5. Write a class that will act as a client to test your remote object. Most of this can come from the code your wrote in step 1. To use a remote object you need to ask the naming service for a remote object reference, then cast that object to an object of type that supports your interface (defined in step 2). Check one of the samples for the details. Step 6. Start up the rmi registry with the command
Step 7. Start up your server (the class created in step 3), and test with your client (created in step 5). NOTE: If any of your remote methods return an object, the
object must be serializable (or it won't work with RMI). You need to have the class
definition for the object type returned | |