Forums Register Login

Question about ConnectionFactory implementation

+Pie Number of slices to send: Send
Hi, Ranchers:
I will bind ConnectionFactory object to RMI. I already have a remote object called RemoteDataAccess. ConnectionFactory has a method
getConnection to create a remote connection for every client. Here is what bafling me: RemoteDataAccess extends UnicastRemoteObject and implements DataInterface, if I have to create another remote object ConnectionFactory, should I do the same thing like: create a ConnectionInterface which extends Remote, and shared by both server and client like DataInterface, then define ConnectionFactory object to extend UnicastRemoteObject and implement ConnectionInterface?
The following code just give me a strange error message:

LINE A just gives me this strange error message:


unreported exception java.rmi.RemoteException; must be caught or declared to be thrown
public class ConnectionGateway extends UnicastRemoteObject


Any help appreciated.
+Pie Number of slices to send: Send
A couple guesses:
1. The interface needs to extend remote
2. The factory constructor needs to throw Remote Exception
+Pie Number of slices to send: Send
Both remote objects should be implemented the same way. The only difference between them is that the factory object will be bound to the registry, and the code for that is outside of the implementation. So, define an interface for both, make sure it extends Remote, and throw RemoteExceptions on your implementation methods.
+Pie Number of slices to send: Send

Thanks for your replies, guys. The above is what exactly I did. All interfaces extend Remote, and
all methods throw RemoteExceptions. Still wondering what's hapening....
+Pie Number of slices to send: Send
Does your constructor throw Remote exception?
public ConnectionGateway() throws RemoteException{
super();
}
+Pie Number of slices to send: Send
 

Originally posted by Robin Underwood:
Does your constructor throw Remote exception?
public ConnectionGateway() throws RemoteException{
super();
}


Thanks Robin, you are right, I missed that one.
Just fixed the problem. I just feel blind sometimes.
Whoever got anywhere by being normal? Just ask this exceptional tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 735 times.
Similar Threads
here I am again - one more time with unreferenced problems
Question about Connection Object
posting again...pl help
Hopefully my final design, comments welcome
dumb qn: Classes stored in Remote client
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:25:17.