wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Tomcat classes loading problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat classes loading problem." Watch "Tomcat classes loading problem." New topic
Author

Tomcat classes loading problem.

Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

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,


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

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

Joined: Jun 25, 2001
Posts: 15952
    
  19

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

Joined: Dec 06, 2005
Posts: 1321

Thanks again Tim, for an informative reply and useful hint.
 
jQuery in Action, 2nd edition
 
subject: Tomcat classes loading problem.
 
Similar Threads
Mac GUI fails 30 percent of the time, debugging, and swing Vs AWT
Changes donot take place..!
static final = ( Long Post )
wscompile question
Java Code Parser