• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

tomcat server must start after the db has started on same pc

 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My tomcat server, and oracle db server are on the same windows 2008 server pc.

during pc restart, how do i make sure that the web application starts properly in the tomcat server in related to the db startup?

the web application will fail to start if it tries to start while the db server hasnt completely started yet.

(this is assuming, both are on windows service auto-start)

e.g. can we put a dependency between 2 applications? e.g. tomcat server will start only after oracle db has started already.
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would'nt rely on the Windows application startup service for this. I don't know if you can have much control over start order but even if you did I would prefer to do it myself.

I suggest that you write a startup script for you application that starts the db first then the webapp after. Once you have this then you can add the startup script as a Windows startup service if you want to.
 
Jesus Angeles
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I saw this Windows' "Automatic (Delayed Start)" on the list of my services.

Looking deeper into it, it has potential. It can be configured, e.g. those set to Delayed Start will start only 2 minutes after all non-Delayed services has completed in their startup.
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not familiar with that delayed start thing so can't comment on it.

But I envisage a couple of undesirable scenarios
  • The DB starts up in seconds. You then have to wait 2 minutes before the app comes up. Ok, but annoying
  • The DB starts up but takes longer than 2 minutes. The app fails.

  • A script that started the DB and then checked that the DB was up before starting the app would be the most reliable solution. Then you could add just that single script into the Windows startup items so then the order of execution by Windows would not matter.
     
    Jesus Angeles
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Tim,

    Would using the script (a .bat file in windows?) solution, need other code changes to be done, or is controlled/solved/coded right on the script, and using script only? (e.g. status generated and checked in script, or must we add like codes in our program so that it outputs e.g. a status file somewhere, where the next program to be ran will check?)

    If it will use a script only set of codes, would you mind pointing me to some materials on the web or what topic to look into?

    I guess what I am asking is, on my current scenario, would I merely add 1 nicely coded script, or will I need additional programs and scripts for monitoring/checking/reporting status of start up?
     
    Jesus Angeles
    Ranch Hand
    Posts: 2108
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Tim Cooke wrote:Then you could add just that single script into the Windows startup items so then the order of execution by Windows would not matter.



    I just realized now, are you referring to the fact that the .bat file in windows will run in a 'sequential' (synchronous/locking) nature, such that the second command wont run unless the first finishes first?
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic