Tomcat reload servlet is very slow, but reload jsp is fast and good?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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...
Regards!
Last edited by Mega Man X; 04-28-2006 at 07:25 PM.
modify a Servlet, you've to recompile your .java Servlet into a .class file.
Regards!
I am already used IDE to compiled it and placed under the WEB-INF....
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.