0

I have two projects on tomcat. Both are web application. One acts like server and another acts as a client. The client application relies on the server application for data. It make data request to server and server respond with data as serialized java object. For the sake of desterilizing client is provided with a stub(Same classes that are streamed from server).

Recently the project was updated on one test server. After updating the arrangement worked fine but with one problem. After keeping the application on browser for 10 to 15 minutes one particular page start to crash. On investigating I found that for that page client is requesting server for some data but server is responding with older version of the same class existing with the client as a stub. This error doesn’t occur before this 10 minute time out. Server returns same class version as that is with client. I can’t figure out from where tomcat is getting the older version of that class after tat idle time out. Error throne is:

   `java.io.InvalidClassException: com.ABC.XYZ; local class incompatible:stream classdesc serialVersionUID = 6683390643574875053, local class serialVersionUID = 100`

To narrow down the error I explicitly defined serialVersionUID fot that class 100L.

   `serialVersionUID = 100L`

Before time out the class XYZ from both server and client prints same serialVersionUID = 100. but after sometime when it crashes it shows the serialVersionUID as 6683390643574875053 which was compiler generated serialVersionUID for the older version.

TH server in question is tomcat6.0 server on cantos6.3. This arrangement is working successfully on production as well as on various other test environment for last couple of years so the code is fine.

Further details will be provided if needed. Any idea what could be causing this. Thanks in advance.

Jafar Ali
  • 1,084
  • 3
  • 16
  • 39
  • Does the crash happen after ten minutes even if the client page is being refreshed within that period, or is it ten minutes of inactivity? – codeghost Jan 23 '13 at 10:46
  • 10 minute of inactivity. – Jafar Ali Jan 23 '13 at 12:20
  • 2
    Tomcat is a bit funny when it comes to classpaths, overloading it's own as it bootstraps merging app specific and shared class paths. Chances are you have the old class in a shared library unintentionally and the new one is being overlaid on startup. After the inactivity the new one is being unloaded and next usage finds the shared instance. Quickest test would be to install a brand new TC instance you know has no shared code and deploy your server and client, you shouldn't get the same problem and you can then spend your time investigating where the rogue class is. – codeghost Jan 23 '13 at 12:27
  • Also, this may help http://www.mulesoft.com/tomcat-classpath – codeghost Jan 23 '13 at 12:29
  • 1
    I tried on the different new Tomcat and it worked. not error. – Jafar Ali Jan 28 '13 at 14:39
  • Glad to hear that. Check out this thread http://stackoverflow.com/questions/3497664/how-to-find-the-jar-file-containing-a-class-definition that should allow you to track down all instances of the offending class in your old Tomcat to help identify which one shouldn't be there (assuming Tomcat doesn't also have multiple external file system locations configured) – codeghost Jan 28 '13 at 14:48

1 Answers1

0

This Was due to corrupt Tomcat on production. Cleaning and install tomcat of same version Solved our problem. Hope this save time for someone with similar problem.

Jafar Ali
  • 1,084
  • 3
  • 16
  • 39