1

In Linux, Tomcat is not loading new class(compiled version of .java file and not JSP file).

What I did:

  1. Overridden class file.
  2. Stopped and started the server, no change in expected behavior.
  3. Deleted old file and placed new one.
  4. Stopped and started the server, no change in expected behavior.
  5. Made a change in source, complied and overridden class file.
  6. Stopped and started the server, no change in expected behavior.

My deployment is in exploded format. Same change is reflected under Windows 8. Earlier, I did update few classes(compiled version of .java file and not JSP file) and restarted the server which reflected the changes as expected.

Environment: Tomcat 7.0 under Amazon Linux AMI release 2013

Please help resolve the problem. Thanks in advance!

user1418717
  • 425
  • 2
  • 5
  • 13
  • Did you build and deploy a new WAR file containing the modified class? Or are you just replacing class files directly in Tomcat's temporary extracted copy of the WAR? – Wyzard Feb 06 '14 at 13:40
  • Old Query. Please check this link [Tomcat Work Directory in Linux envrionment][1] [1]: http://stackoverflow.com/questions/11246392/tomcat-work-directory-has-to-be-cleared-periodically – Mahesh Modukuru Feb 06 '14 at 13:42
  • As stated in OP, problem is related to a class file(compiled version of .java file and NOT .jsp file). – user1418717 Feb 06 '14 at 13:48

1 Answers1

2

Whenever you have strange tomcat issues like this, the first thing to do is stop tomcat, delete the work directory, delete the deployment directories. Then re-deploy the war file and restart.

Always do this before trouble-shooting further as it usually fixes weird deployment issues.

Thom
  • 14,013
  • 25
  • 105
  • 185
  • COMMENT 1/2: I accept your answer, though I would have done eventually same but, with a least impact approach. Firstly, as mentioned in OP, problem was with a class file(compiled version of .java file and not JSP) so, it has no effect of deleting 'work' directory. The 'work' directory is used to store only generated class files from .jsp files. Secondly, I had mentioned, my deployment is in exploded format. Re-deploy of war file or entire deploy unit is a costly and risky task in live/production environment. – user1418717 Feb 07 '14 at 06:08
  • COMMENT 2/2: So, I suggest a least impact approach - override the directory in which the file resides with newly compiled version. Example: if the file is in com/myCompay/department/sub-department/Employee.class then override department or sub-department directory, and re-start the server. Hope this helps others too. – user1418717 Feb 07 '14 at 06:09