Clear Tomcat Classloader cache?

T

tkonrath

Hi.

As fas as I know, the classloader of the tomcat server caches all
classes, which has been requested once, in the ram. Further request do
not read the file from disk, they are using the information in the
ram.

We want to clear this cache or force the classloader, do read the
class-files (and any other ressource files) once again from disk,
without rebooting the server or restarting the webapp.

Is this possible?

Thanks for help.

Thomas Konrath
 
T

Tom Hawtin

We want to clear this cache or force the classloader, do read the
class-files (and any other ressource files) once again from disk,
without rebooting the server or restarting the webapp.

That's effectively what restarting the webapp does. What are you trying
to achieve that is different?

Tom Hawtin
 
E

Esmond Pitt

That's not just the Tomcat classloader, that's *any* classloader. The
only way to achieve what you want is to use a new classloader. And the
only way to achieve that in Tomcat AFAIK is to restart the webapp.
 
C

Cheng Wei Lee

Hi.

As fas as I know, the classloader of the tomcat server caches all
classes, which has been requested once, in the ram. Further request do
not read the file from disk, they are using the information in the
ram.

We want to clear this cache or force the classloader, do read the
class-files (and any other ressource files) once again from disk,
without rebooting the server or restarting the webapp.

Is this possible?

Thanks for help.

Thomas Konrath

I think what you meant to do is to reload the context of your
application after your classes have been updated. To do so, go to
Tomcat Manager and restart your context. Beaware that the classes stay
in the Permanent Generation so they will eventually fill up the
Permanent generation Heap space, which means that you will eventually
have to restart Tomcat or you will run out of memory.

Cheng
 
T

tkonrath

I think what you meant to do is to reload the context of your
application after your classes have been updated. To do so, go to
Tomcat Manager and restart your context. Beaware that the classes stay
in the Permanent Generation so they will eventually fill up the
Permanent generation Heap space, which means that you will eventually
have to restart Tomcat or you will run out of memory.

Cheng

Hi.

Thanks for your replies.

The background of my question was just do be able to replace class-
files or other ressource files while tomcat is sill running and all
user sessions keep alive. Restarting the webapp has two negative
aspects: 1) all user sessions would be lost and 2) as you mentioned,
tomcat will run out of memory.

So we have to think of another way to solve our problem.

Thanks for help

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top