You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Pradeep Fernando <pr...@gmail.com> on 2012/02/16 12:28:04 UTC

Is it possible to start multiple tomcat servers with port-offset mechanism

Hi all,

I want to start multiple tomcat server instances by giving a port
offset kind of parameter. I dont want to hard code the port. A
port.offset system property would be ideal.

say my default port is 8080. with port.offset param  set to  '1'. it
would be 8081.

8080 + ${port.offset}

Is there any mechanism to fulfill my requirement. ?

thanks,
--Pradeep

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Is it possible to start multiple tomcat servers with port-offset mechanism

Posted by Pid <pi...@pidster.com>.
On 16/02/2012 11:34, Konstantin Kolinko wrote:
> 2012/2/16 Pradeep Fernando <pr...@gmail.com>:
>> I want to start multiple tomcat server instances by giving a port
>> offset kind of parameter. I dont want to hard code the port. A
>> port.offset system property would be ideal.
>>
>> say my default port is 8080. with port.offset param  set to  '1'. it
>> would be 8081.
>>
>> 8080 + ${port.offset}
>>
>> Is there any mechanism to fulfill my requirement. ?
> 
> You can use properties substritution.
> E.g.  create $CATALINA_BASE/bin/setenv.sh:
> [[[
> JAVA_OPTS=-Dmyportnumber=8083
> ]]]
> and use port="${myportnumber}" in server.xml
> 
> It is up to you how to calculate the port number.

+1  If you're generating an offset, why not just calculate the actual
port number?


p


-- 

[key:62590808]


Re: Is it possible to start multiple tomcat servers with port-offset mechanism

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/2/16 Pradeep Fernando <pr...@gmail.com>:
> I want to start multiple tomcat server instances by giving a port
> offset kind of parameter. I dont want to hard code the port. A
> port.offset system property would be ideal.
>
> say my default port is 8080. with port.offset param  set to  '1'. it
> would be 8081.
>
> 8080 + ${port.offset}
>
> Is there any mechanism to fulfill my requirement. ?

You can use properties substritution.
E.g.  create $CATALINA_BASE/bin/setenv.sh:
[[[
JAVA_OPTS=-Dmyportnumber=8083
]]]
and use port="${myportnumber}" in server.xml

It is up to you how to calculate the port number.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org