Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load servlet automatically when changed without restarting server

 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai buddies,
is there any solution for loading the servlet automaticaly when it is changed rather than restarting the server for every change done to the file.(this is very problematic when developing servlet, restarting server everytime).
thanks
regards,
Mahesh
 
Prathiba Kalirengan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compile your servlet files to put the classes with the correct package structure in the path where the server has the class files.
javac -d <directory where the server stores its servlet classes> <source files>
just refresh the servlet...
I hope this is what you have asked for...
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear pratibha,
hope u have not got me. if we use servlets , we have to make entries in web.xml (i use tomcat webserver) file.when we start server the servlet is loaded by taking the info from web.xml file. when i change the same servlet and need to reflect the changes, we need to restart the server and access the servlet.(becoz like JSP pages tomcat server will not check automatically for latest versions of servlets.we can request the changed JSP page without restarting the server as the server automatically checks for new versions in case of JSP).
hope u got me now.
whatz the solution for this.
regards,
mahesh
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Servlets forum.
 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just have to set the context to be reloadable in the context configuration file. ( server.xml )
 
jbig zala
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mahesh,
If u r using tomcat4 or above.
It will automatically detect your modified servlet. and Loads them again by server when any request for it.
Ya Old thread will remain there.
 
Chandra Sekhar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Try this...

Modify ur server.xml like this

<Context path="/myapp" docBase="myapp" debug="7" reloadable="true">
<Loader className="org.apache.catalina.loader.WebappLoader" reloadable="true" checkInterval="5" debug="7"/>
</Context>

Chandrasekhar
SCJP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic