I have a JSP/Servlet web application deployed in Glassfish which is having a number of Servlets and huge class files.
When I make even minor changes in the Servlet or class file, then the whole web application gets re-deployed which takes considerable amount of time.
Not only that, all the JSPs and Servlets are unloaded from memory and upon being called it takes around 1 second for getting initialized.
This problem does not occur when I change code of JSP, JS or CSS files as only that particular file is re-deployed.
Can I do anything so that the Servlets or those huge class files are deployed separately
and thus I do not have to deploy the whole web application?
No matter what is tried, the application must be restarted when a class file is updated.
Agreed that it needs a server restart , but deployment Time can be saved and only need to sepnd time on server restart , which the actual question was all about .
(Why to deploy all the jsps and all java files involved when only a single servlet is modified ??)\
(In the context of running a build.xml file for deployment ).
If this is of paramount concern, then you can use OSGI to restructure your web app in a way that only few classes might need to be reloaded. Or optimize the web app startup so that whatever takes up all that time happens in the background.
Joined: Aug 12, 2004
should i go for opening a glassfish issue/enhancement as jsp/servlets are here for less than a decade now... still a simple feature missing...
Joined: Mar 22, 2005
It is not simple. Early servlet containers tried to reload individual classes when they got updated, but as web apps got more complicated it quickly became obvious that the approach was unworkable - objects are being kept in caches, collections etc. and don't go out of scope, so they can't be replaced with a new class definition.
As I said, you should restructure your web startup process.