B
brian
I have an interesting question (or at least to me it is). After
reading about the different type of class loaders (e.g. webapp(s),
System, Common, Shared, Ext.) in Tomcat and doing some testing I
noticed an interesting thing regarding a static variable within a
class that was loaded with the webapp class loader.
I have a class called JSPBean and within this bean I have a static
variable didLoadAppProperties.
public abstract class JSPBean {
private static boolean didLoadAppProperties = false;
// setter & getter removed to keep class short for posting.
}
I thought that if I set didLoadAppProperties = true from my JSP page
in my app the value would remain true for the life of the application
(unless I update it again or stop tomcat). However in my JSP page I
set the didLoadAppProperties = true and then wait a few days. If I go
to another JSP page in the same application a few days later I can
check the value of this static variable and it will be false. If I
print out the class loader on the page I notice that it has a
different class loader than the original one from three days ago.
Any ideas on if this theory is correct or why this might be happening
to me?
reading about the different type of class loaders (e.g. webapp(s),
System, Common, Shared, Ext.) in Tomcat and doing some testing I
noticed an interesting thing regarding a static variable within a
class that was loaded with the webapp class loader.
I have a class called JSPBean and within this bean I have a static
variable didLoadAppProperties.
public abstract class JSPBean {
private static boolean didLoadAppProperties = false;
// setter & getter removed to keep class short for posting.
}
I thought that if I set didLoadAppProperties = true from my JSP page
in my app the value would remain true for the life of the application
(unless I update it again or stop tomcat). However in my JSP page I
set the didLoadAppProperties = true and then wait a few days. If I go
to another JSP page in the same application a few days later I can
check the value of this static variable and it will be false. If I
print out the class loader on the page I notice that it has a
different class loader than the original one from three days ago.
Any ideas on if this theory is correct or why this might be happening
to me?