I believe I may have discovered a hot-deployment bug in JBoss 4.0.4.
I am running a webapp that initialized a static variable (singleton) indirectly by a servlet loaded on startup. While testing this application, I kept having intermittent NullPointerExceptions while trying to access this variable in my application. Not only was this strange, but by merits of the code being executed, it was impossible. However, I discovered that the only time this NullPointerException would rear its head was after a hot-deployment of a new version of the WAR. I then suspected, and confirmed, that the loading of this WAR during hot-deployment is knocking over this static singleton variable, which after hot-deployment becomes null. I confirmed this by removing the static nature of this variable and instead making it an instance variable. Hot deploying then caused no more problems in my code.
However, this isn't where the problem ended. My webapp depends on Hibernate, and my webapp loads the Hibernate configuration upon startup. After changing my code to eliminate the static singleton which was causing me problems, now I believe I am seeing the exact same problem now manifested in Hibernate code. It now is blowing up. I haven't yet been able to completely trace the problem in Hibernate source, but I am going to do so today.
Is there someone out there who can give more information on the nature of this problem? If the assertion is correct, that static singletons basically cripple hot-deployment, that's tantamount to eliminating hot-deployment as a feature in JBoss. While it may be possible to change your own code to eliminate such static singletons, you have no control over third-party libraries. I hope this not the nature of the problem.
Responses are greatly appreciated.