| Author |
How to get servlets to reload automatically when server is reset?...
|
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
Does anyone know how I can achieve this? Thanks in advance, James
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
James, Can you explain what you mean? The servlet classes do get reloaded if you restart the server. [ February 21, 2005: Message edited by: Ben Souther ]
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Frank Hale
Ranch Hand
Joined: Mar 25, 2000
Posts: 230
|
|
I know exactly what he's talking about. He wants his servlets to automagically reload when he changes them and he doesn't want to restart the server because that is not intuitive and not something that seems logical. I got tripped up on this when I started and I just couldn't figure out why Tomcat wouldn't reload my web app by default. Would I restart apache everytime I change a php script? I think not. The way you have to do this is to set up a context for your web application then set it's reloadable property to true. I won't tell you exactly how to do this because I am also starting out and I don't want to tell you the wrong way to go about it and there are many tutorials on google.com which describe how to do this. I also beleive that <DefaultContext reloadable="True"> inside conf/web.xml will also do it but don't quote me on it. Check this out: http://www.jspbook.com/freechapters.jsp There is an entire free JSP/Servlet book for download. I have been reading through this and it's given me the exact information I needed to understand what the hell this server side java stuff is all about. I suggest you also read this. It's worth the price of free!!! [ February 21, 2005: Message edited by: Frank Hale ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
He wants his servlets to automagically reload
If that's what he meant, his question could use some rewording.
Would I restart apache everytime I change a php script? I think not.
Not a particularly apt analogy. php scripts are more akin to JSP pages which do automatically reload. That said, yes, setting up the context to reload automatically in the debug environment (this is not appropriate for a production system) is a good way to go. Note, only the app context requires reloading: stoppng and starting the entire server is not necessary. This can also be done "by hand" using the manager application. [ February 21, 2005: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Frank Hale
Ranch Hand
Joined: Mar 25, 2000
Posts: 230
|
|
|
I must admit after rereading his post he was trying to do something else. I misread. Sorry!
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
No need for an apology. You're trying to help. That's good!
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
Thanks for the replies guys. I was looking for the init() method to be called at server startup - sorry for not making that clear. I've found the solution now - the <load-on-startup> tag. Cheers, James
|
 |
 |
|
|
subject: How to get servlets to reload automatically when server is reset?...
|
|
|