even with unloadDelay="60000" in conf/context.xml probably Servlet jsp is undeployed before spring servlet, and when spring servlet wants to use it to render jsp - it is already undeployed (and results in : HTTP Status 503 - Servlet jsp is currently unavailable)
question is how to make Servlet jsp undeployed as last servlet, afaik there is no priority opposite to <load-on-startup>100</load-on-startup> deciding when servlet is undeployed. is there any solution in tomcat ? can we prevent tomcat from unloading servlets for some time ? can we tell tomcat to stop accept new requests ? Regards Jakub On Tue, Jan 14, 2014 at 1:48 AM, Ja kub <jjaku...@gmail.com> wrote: > I modified conf/context.xml <Context unloadDelay="60000"> > I hoped tomcat would wait 60 seconds for request to end. > But there are some problems with spring app, I get > > HTTP Status 503 - Servlet jsp is currently unavailable: > > I use tomcat 7.42 64 bit on windows 7 > > steps to reproduce: > > use app from https://github.com/spring-projects/spring-petclinic > > git clone https://github.com/SpringSource/spring-petclinic.git > > to VetController class add: > > @RequestMapping("/vets/{delay}") > public String showVetListDelayed(@PathVariable int delay, Map<String, > Object> model) { > // Here we are returning an object of type 'Vets' rather than a > collection of Vet objects > // so it is simpler for Object-Xml mapping > Vets vets = new Vets(); > vets.getVetList().addAll(this.clinicService.findVets()); > model.put("vets", vets); > try { > Thread.sleep(1000*delay); > } catch (InterruptedException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (Exception e) { > e.printStackTrace(); > } > System.err.println("woken up ---------------------------"); > return "vets/vetList"; > } > > mvn clean install > > // copy from target to webapps > > go to > http://localhost:8080/petclinic/vets/5 > hit ctrl C > > app sleeps, wait until > System.err.println("woken up ---------------------------"); executes !!!! > but browser gets error. > > below is console log: > > Hibernate: select distinct vet0_.id as id1_5_0_, specialty2_.id as > id1_2_1_, vet0_.first_ > specialty2_.name as name2_2_1_, specialtie1_.vet_id as vet1_5_0__, > specialtie1_.specialt > join vet_specialties specialtie1_ on vet0_.id=specialtie1_.vet_id left > outer join special > alty2_.id order by vet0_.last_name, vet0_.first_name > Jan 14, 2014 1:20:15 AM org.apache.catalina.core.StandardServer await > INFO: A valid shutdown command was received via the shutdown port. > Stopping the Server in > Jan 14, 2014 1:20:15 AM org.apache.coyote.AbstractProtocol pause > INFO: Pausing ProtocolHandler ["http-apr-8080"] > Jan 14, 2014 1:20:15 AM org.apache.coyote.AbstractProtocol pause > INFO: Pausing ProtocolHandler ["ajp-apr-8009"] > Jan 14, 2014 1:20:15 AM org.apache.catalina.core.StandardService > stopInternal > INFO: Stopping service Catalina > Jan 14, 2014 1:20:16 AM org.apache.catalina.core.StandardWrapper unload > INFO: Waiting for 1 instance(s) to be deallocated for Servlet [petclinic] > woken up --------------------------- > INFO XmlWebApplicationContext - Closing WebApplicationContext for > namespace 'petclinic-s > ]; parent: Root WebApplicationContext > INFO XmlWebApplicationContext - Closing Root WebApplicationContext: > startup date [Tue Ja > INFO AnnotationMBeanExporter - Unregistering JMX-exposed beans on shutdown > INFO EhCacheManagerFactoryBean - Shutting down EhCache CacheManager > INFO LocalContainerEntityManagerFactoryBean - Closing JPA > EntityManagerFactory for persi > Jan 14, 2014 1:20:22 AM org.apache.catalina.loader.WebappClassLoader > clearReferencesJdbc > SEVERE: The web application [/petclinic] registered the JDBC driver > [org.hsqldb.jdbc.JDBC > plication was stopped. To prevent a memory leak, the JDBC Driver has been > forcibly unregi > Jan 14, 2014 1:20:22 AM org.apache.catalina.loader.WebappClassLoader > clearReferencesThrea > SEVERE: The web application [/petclinic] appears to have started a thread > named [PoolClea > p it. This is very likely to create a memory leak. > Jan 14, 2014 1:20:22 AM org.apache.coyote.AbstractProtocol stop > INFO: Stopping ProtocolHandler ["http-apr-8080"] > Jan 14, 2014 1:20:22 AM org.apache.coyote.AbstractProtocol stop > INFO: Stopping ProtocolHandler ["ajp-apr-8009"] > Jan 14, 2014 1:20:22 AM org.apache.coyote.AbstractProtocol destroy > INFO: Destroying ProtocolHandler ["http-apr-8080"] > Jan 14, 2014 1:20:22 AM org.apache.coyote.AbstractProtocol destroy > INFO: Destroying ProtocolHandler ["ajp-apr-8009"] > > > Regards > Jakub >