Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a server JAR that is deployed once per customer, it is the API server for their software package. To that end, the port for each API instance must be the same, so that anything programmed against it can always find it. Each instance is deployed on a different domain name

The problem I'm having is that, even when using a SelectChannelConnector and setting the host property, I can't get two instances to run simultaneously, I get a BindException with "Address already in use".

I suppose my question is: can Jetty do this, or do I need to do some external re-writing, or is there a better way I can go about achieving the same ends?

Thanks.

share|improve this question
    
Are you running the API server code for several customers on a single machine of yours? Are you testing or hosting it? –  Allen Jul 4 '10 at 16:17

2 Answers 2

up vote 0 down vote accepted

Assuming that I understand what you are trying to do, it seems the easiest way is to front your jetty instances with apache. Set apache up with virtual hosts and the appropriate configuration to send each virtual host's requests to the appropriate jetty instance.

share|improve this answer
    
Thanks Allen, this is roughly what I did, but I used Jetty instead, and each API instance tells the Jetty proxy server which port to find it on, and the Jetty proxy forwards the request appropriately. –  Martin Jul 5 '10 at 12:05

A bit late maybe but, it this what you're looking for? You'll configure a single connector (because you're listening on a single port) but let it answer for different domain names, and then you configure each webapp to answer to only a single domain. You can even make them have the same context path, so the only thing you change in your client code is the domain name.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.