Client-server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Navdip
    New Member
    • Mar 2008
    • 22

    Client-server

    Hi All,
    i'm implementing client & server in my java application. in which client and server both have same class structure which they want to access . client wants some data related to its class member, and server provide those data at that time by writting the object of similar class to client.. client reads that object of class and that data.....
    but problem is that ....they are working very well when client and server are in same folder but if client and server in different folders then client generates "java.io.Invalid ClassException: EventLogEntry1; local class incompatible: stream classdesc serialVersionUI D = 152207781964363 0823, local class serialVersionUI D = -672034292979139 3780"...error at run time where EventLogEntry1 is the class name in both client & server...so please give me the solution if u have....
    -thanks
  • talonx
    New Member
    • Mar 2008
    • 18

    #2
    Originally posted by Navdip
    Hi All,
    i'm implementing client & server in my java application. in which client and server both have same class structure which they want to access . client wants some data related to its class member, and server provide those data at that time by writting the object of similar class to client.. client reads that object of class and that data.....
    but problem is that ....they are working very well when client and server are in same folder but if client and server in different folders then client generates "java.io.Invalid ClassException: EventLogEntry1; local class incompatible: stream classdesc serialVersionUI D = 152207781964363 0823, local class serialVersionUI D = -672034292979139 3780"...error at run time where EventLogEntry1 is the class name in both client & server...so please give me the solution if u have....
    -thanks
    Hello,
    The error means that you have two different versions of the same class (EventLogEntry1 ) - one on the server side, the other on the client side. When one side of the socket tries to read the serialized class and load the class definition that it has, it turns out to be different than the one that the other side has sent over the socket.
    To explain further, different versions of the same class means you have changed something in the class (field, method signature etc) and compiled it, and put it on the classpath of either the server or the client. While the other side has the older compiled class file. (This is also evident from your own statement as to when it works).

    The solution is to have the same versions of your classes on both client and server.
    You might also want to read up on Java object serialization.

    Hope this helps.

    Regards
    talonx

    Comment

    • Navdip
      New Member
      • Mar 2008
      • 22

      #3
      Originally posted by talonx
      Hello,
      The error means that you have two different versions of the same class (EventLogEntry1 ) - one on the server side, the other on the client side. When one side of the socket tries to read the serialized class and load the class definition that it has, it turns out to be different than the one that the other side has sent over the socket.
      To explain further, different versions of the same class means you have changed something in the class (field, method signature etc) and compiled it, and put it on the classpath of either the server or the client. While the other side has the older compiled class file. (This is also evident from your own statement as to when it works).

      The solution is to have the same versions of your classes on both client and server.
      You might also want to read up on Java object serialization.

      Hope this helps.

      Regards
      talonx
      Hi..Talonx
      This is navdip.....i read your response & thanks to help...but as u wrote different version of class means there is mismatching of classes...but i gave same structure of classes in both client and server...only difference is that i took a constructor in server side to initialize their data...then should i remove that constructor..

      Comment

      • Navdip
        New Member
        • Mar 2008
        • 22

        #4
        Thanks .....yaar i have removed the constructor fron server side And now its working... please keep in touch

        Comment

        • Navdip
          New Member
          • Mar 2008
          • 22

          #5
          Originally posted by Navdip
          Hi..Talonx
          This is navdip.....i read your response & thanks to help...but as u wrote different version of class means there is mismatching of classes...but i gave same structure of classes in both client and server...only difference is that i took a constructor in server side to initialize their data...then should i remove that constructor..


          Hi..Talonx...
          i have removed that constructor from server side now its working properly....Tha nks a lot..

          Comment

          • talonx
            New Member
            • Mar 2008
            • 18

            #6
            Originally posted by Navdip
            Hi..Talonx...
            i have removed that constructor from server side now its working properly....Tha nks a lot..
            Good to know it helped.
            Cheers!
            - talonx

            Comment

            Working...