Originally posted by Kris Reid:
Apparently the problem with Static variables is they are only available in a single JVM. Since I am running Sun App server on a single processor it will only have one JVM so no problem. Right??
You will have problems also if the JVM uses more than one class loader. If a class is loaded more than once in different class loaders than, each class loader will have his own static variables.
And the bad news is that, all J2EE app servers use different class loaders for different deployed applications.
I see 2 possible solutions.
1. Use a 'J2EE Singleton' a regular object and bound it in the JNDI tree.
2. Use some Caching strategy implemented trough AOP. (I am not sure if it is possible with ejbs)I implemented this kind of caching strategy for Spring.