i have written two little applications one is working on the client-side. the other one is running on the server-side. i have created an interface on both sides with the same name "ServisArayuzu" and these interfaces has one method .
public interface ServisArayuzu { public String getIsim(); } both classes on the server and on the client side implements this interface differently.
try { server=new ServerSocket(1500); nextClient=server.accept(); OutputStream os=nextClient.getOutputStream(); ObjectOutputStream oos=new ObjectOutputStream(os); oos.writeObject(new XY("serdar","ilter")); //here XY object is succesfully created oos.flush(); oos.close(); } catch (IOException ioe) { System.err.println ("Error " + ioe); } i'am ok establishing the connection with the IP and a port. connection is working.
client-side:
try { client=new Socket("10.10.20.84",1500); ObjectInputStream ois=new ObjectInputStream(client.getInputStream()); ServisArayuzu a= (ServisArayuzu) ois.readObject(); String b=a.getIsim(); txtRemoteX.set_Text(b); client.close(); } catch (IOException ioe) { System.err.println ("Error " + ioe); } catch (ClassNotFoundException cnfe) { System.err.println ("Error " + cnfe); } before server-side goes oos.flush() application throws ClassNotFoundException on the client-side. Why how will I run the server-side intance's method getIsim()

running server object method from client-side on the network
TheRoon
Class Metadata means the function signatures, variables names\types.
Thanks,
ronmurp
millerfj
frog37
You are getting classNotfoundException on client side because we need to refer a class with same metadata on client side as well, otherwise deserialization on client side will fail.
So you would need to include class XY on client side as well.
Now if you want to run server-side instance method. Just compile XY on server side into a xy.dll and refer that dll from client side. Then deserialization will be succesful and it would run server side method as well.
Thanks,
CoreyMasson
could i learn what you do mean by metadata can you give a little example
David Zillner
Viper446
Package information is also part of metadata. If you are able to complie the code but not able to run becauase of ClassNotFoundException, then you are missing the assembly in which the class is defined. I mean CLR is not able to locate the required assembly.
If you can post entire exception trace (Stack trace) then we can zero in the issue.
Thanks.
eferreyra
Thanks,
Srik
i have written two little applications one is working on the client-side. the other one is running on the server-side. i have created an interface on both sides with the same name "ServisArayuzu" and these interfaces has one method .
public interface ServisArayuzu{
public String getIsim();
}
both classes on the server and on the client side implements this interface differently.
try
{
server=new ServerSocket(1500);
nextClient=server.accept();
OutputStream os=nextClient.getOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(os);
oos.writeObject(new XY("serdar","ilter"));
//here XY object is succesfully created
oos.flush();
oos.close();
}
catch (IOException ioe)
{
System.err.println ("Error " + ioe);
}
i'am ok establishing the connection with the IP and a port. connection is working.
client-side:
try
{
client=new Socket("10.10.20.84",1500);
ObjectInputStream ois=new ObjectInputStream(client.getInputStream()); ServisArayuzu a= (ServisArayuzu) ois.readObject();
String b=a.getIsim();
txtRemoteX.set_Text(b);
client.close();
}
catch (IOException ioe)
{
System.err.println ("Error " + ioe);
}
catch (ClassNotFoundException cnfe)
{
System.err.println ("Error " + cnfe);
}
before server-side goes oos.flush() application throws ClassNotFoundException on the client-side. Why how will I run the server-side intance's method getIsim()
DIEGOE