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?
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.
精彩评论