Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-28-2006, 12:18 AM   #1
Registered: Jan 2003
Posts: 42

Rep: Reputation: 15
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?
Old 04-28-2006, 05:08 PM   #2
Mega Man X
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
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...


Last edited by Mega Man X; 04-28-2006 at 08:25 PM.
Old 04-28-2006, 10:34 PM   #3
Registered: Jan 2003
Posts: 42

Original Poster
Rep: Reputation: 15
Originally Posted by Mega Man X
modify a Servlet, you've to recompile your .java Servlet into a .class file.
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
still problem in reload grub manomohan Red Hat 1 09-27-2005 08:22 AM
how to reload linux? zacherfamily Linux - Newbie 1 09-06-2005 11:50 PM
reload rh9 bobby_hawk Linux - Software 1 05-28-2005 10:07 AM
xinetd reload failed allelopath Linux - Networking 6 04-14-2005 05:38 PM
PCMCIA reload MattLaw Linux - Laptop and Netbook 3 09-04-2003 06:44 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration