Sagar Patel

Greenhorn
+ Follow
since Oct 09, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sagar Patel

Am willing to initialize an array of InetAddress in the class declaration....

As Expected the following code gives a an unhandled UnknownHostException, however, i cannot surround it with try/catch as its in the class declaration...Where am i goofing up...?!

Can I not by anyway initialize the InetAddress array in the class declaration portion...


Fallen into another problem...
Its with initializing InetAddress......
Am willing to initialize an array of InetAddress in the class declaration....

As Expected the following code gives a an unhandled UnknownHostException, however, i cannot surround it with try/catch as its in the class declaration...Where am i goofing up...?!


15 years ago
Well if thats the only fallback so be it...!!
Cheers guys for prompt replies...!!
15 years ago
Thanks for the reply....

Is there any way around this limitation...
Can i pass a socket by any way.....!!
All i require of the Remote object is passing a reference of one of three server which is running...
I am willing to employ fault-tolerant server model...
Either this way or other, can anyone please suggest a way around...!!
15 years ago
I am not a pro with RMI, however,
from the little I know about RMI...

You need the the RMIserver, RMIimplementation, and RMIclass files at the server.....
and RMIclass, and RMIclient at the client side...!!

P.S.
RMIServer - the class that binds the class
RMIimplementation - the class that has the implementation of the class
RMIclass - the class that has the interface
RMIclient - name is suggestive...
15 years ago
I am new to RMI (and java), and am having trouble getting through RemoteException while returning socket from a remote object...
CAN ANYONE PLEASE POINT OUT THE POSSIBLE CAUSE FOR THE EXCEPTION....!!!
The remote object needs to return a socket to the calling client...
The exception is as below:

C:\>java RmiClient
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableE
xception: java.net.Socket
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at RmiImpl_Stub.getSocket(Unknown Source)
at RmiClient.main(RmiClient.java:12)
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializab
leException: java.net.Socket
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
... 3 more
Caused by: java.io.NotSerializableException: java.net.Socket
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
C:\>java RmiClient
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableE
xception: java.net.Socket
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at RmiImpl_Stub.getSocket(Unknown Source)
at RmiClient.main(RmiClient.java:12)
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializab
leException: java.net.Socket
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
... 3 more
Caused by: java.io.NotSerializableException: java.net.Socket
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Sou
rce)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


----------------------------
P.S. - Have tried using the returning method locally, and works fine.....so assuming there is no issues on the rmiImplementation side...
15 years ago
I am new to RMI (and java), and am having trouble getting through RemoteException while returning socket from a remote object...
CAN ANYONE PLEASE POINT OUT THE POSSIBLE CAUSE FOR THE EXCEPTION....!!!
The remote object needs to return a socket to the calling client...
The exception is as below:

C:\>java RmiClient
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableE
xception: java.net.Socket
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at RmiImpl_Stub.getSocket(Unknown Source)
at RmiClient.main(RmiClient.java:12)
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializab
leException: java.net.Socket
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
... 3 more
Caused by: java.io.NotSerializableException: java.net.Socket
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
C:\>java RmiClient
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableE
xception: java.net.Socket
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at RmiImpl_Stub.getSocket(Unknown Source)
at RmiClient.main(RmiClient.java:12)
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializab
leException: java.net.Socket
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
... 3 more
Caused by: java.io.NotSerializableException: java.net.Socket
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Sou
rce)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


----------------------------
P.S. - Have tried using the returning method locally, and works fine.....so assuming there is no issues on the rmiImplementation side...