This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Tomcat classes loading problem.  RSS feed

 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • 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,

 
Bartender
Posts: 20775
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • 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
Bartender
Posts: 20775
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks again Tim, for an informative reply and useful hint.
 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!