Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Tomcat classes loading problem.

 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rachers,

Working on application where I am upload a Test java source file and compiling and running it over the web.
the problem I having here if the same test file upload again after some changes and run this file again.. the changes are not effecting
its like loading a previous .class instead even the .class and .java are updated with file modified date on server but don't know
where this loading previous .class which is not even exist. might be a cache problem but I don't know how to overcome this issue.

any help would be appreciated.

Thanks,

 
Saloon Keeper
Posts: 24829
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Updates to running Tomcat apps are not instantaneous. Tomcat scans periodically, so if you don't give it a minute or so to "take", you could end up still running the old code.

Not all resource updates perform well on the fly, though. Stuff with static initialization, stuff that's initialized on app startup can be resistant. Plus, Tomcat6 is infamous for running out of PermGen space when updating, so I usually just cycle Tomcat. It doesn't take that long unless you're doing it on a server with lots of apps with extensive startup/shutdown code.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Tim,

and Yes, a few minutes back found the solution for this problem.. I just put this attribute reloadable="true" under tomcat/conf/context.xml



and this solve my problem.. its load the changed .class file without any sweat.

Tomcat6 is infamous for running out of PermGen space when updating,



I agree with statement because i have seen this error during my development.

for that I read somewhere to extend memory of primsize with little text initialization of JAVA_OPTS variable inside catalina.sh under tomcat/bin/



now this got solved and premGen error didn't show up again..
 
Tim Holloway
Saloon Keeper
Posts: 24829
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah yes, that option is on by default, but it wouldn't be an option if it couldn't be turned off!

As far as I know, the PermGen issue is a memory leak, so bumping it just expands the number of reloads you can do before it runs out. On the other hand, I had to seriously bump up PermGen just to even run more than one Hibernate/JSF webapp in Tomcat, because that architecture eats up a lot of PermGen to begin with.

Helpful hint: don't modify the catalina.bat/.sh file for JAVA_OPTS settings. Create a TOMCAT_HOME/bin/setenv.sh (or setenv.bat) and define JAVA_OPTS there. It's easier to maintain.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again Tim, for an informative reply and useful hint.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic