1

I am working on java 6, eclipse and tomcat . I have 2 projects in a workspace , 1 is a webservices client and the other is a webservices server. both projects are deployed under tomcat instance, so when I run the tomcat server it starts up both projects. when the client project starts up before the server project service is available , the client gets stuck in the following function and dosent finish to startup:

protected Service(java.net.URL wsdlDocumentLocation, QName serviceName) {
    delegate = Provider.provider().createServiceDelegate(wsdlDocumentLocation,
            serviceName,this.getClass());}

so I need the server project to start first and have the client project start only after the server finishes.

is that possible?

dov.amir
  • 11,489
  • 7
  • 45
  • 51

1 Answers1

3

The short answer - you need to write your client application so that it can detect if the server application is down and act accordingly. If the dependencies run both ways, then you have to ensure that the failure conditions are handled in both.

Also, ensure they don't depend on each other during container startup; the dependency can be established later, when the applications have all started. This in part because, Eclipse does not determine the startup order. Tomcat does, and it will not allow you to dictate which application should start first. You can read this related question.

Community
  • 1
  • 1
Vineet Reynolds
  • 76,006
  • 17
  • 150
  • 174
  • i guess I could also create 2 different tomcat instances/instalations, and put each project in a different tomcat instance. then i can start one project after another manualy – dov.amir Jun 15 '11 at 20:08
  • Yes, you can do that, if you want to manage application startups manually. You just need to [create another Tomcat base directory and have Eclipse WTP use that](http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_does_WTP_support_separate_Tomcat_server_instances.3F). – Vineet Reynolds Jun 15 '11 at 20:16