Tomcat reload servlet is very slow, but reload jsp is fast and good?
I am working in an application which contains both jsp and servlet.
For modifying jsp, the modification is effective after I refresh the webpage. That's fine.
For modifying servlet, it is annoying!!!
I have config the context in server.xml with reloadable=true crosscontext=true
But it still have two big issues:
1. it need to have 10-15 seconds for the modification to be effective (even I have set checkInterval="1", no help)
2. the session is destroyed. (I need to login to my application again and do all the previous work for entering the place I needed to test, what's annoying!!!)
Do anyone know why? How can I do the reloading of servlet just simple like reloading jsp?
I think the reason behind it is because everytime you modify a Servlet, you've to recompile your .java Servlet into a .class file. That operation may take some time. When you modify a .jsp page, which in turn makes a call to a servlet, that servlet is already compiled (into a .class).
I could be wrong though. Anyway, I have noticed the same delay as you do (although, not as long as 10-15 seconds, more like 5) whereas jsp is a snap.
Depending how long your tomcat takes to start, it might be a better solution to restart the server every time you modify a Class/Servlet.
I am not sure if you are using an IDE, but I would gladly recommend you Eclipse WTP. With the right plugins, you will be able to start/stop Tomcat from within the IDE and test intensively your code before deploying it. It will also help you with other things, such as registering a new Servlet at your web.xml file on the fly. Eclipse WTP will certainly save you a lot of time ^_^. I can give a hand with the plugins and stuff if you need...
Actually, I concern more on the session, since every restarting or reloading (but I don't know why reload will also destory the session) will destory the session. Even I used the Manager App to reload, the problem is still the same.
Automating the restarting job in IDE may not help in this manner. However, it is quite pretty and I would try it on other projects.
|All times are GMT -5. The time now is 12:52 PM.|