John Smith schrieb:
Is it possible by using tomcat 6.0.20 with different instances with diff ips but same port no 80 on one system ???
Only one process can bind to any given IP/port combination.
I ran instance a on port 80 (it ran), but when I tried to run another instance b on port 80 ( I got
java.net.BindException: Address already in use
Because that port is already taken for the IP number in question.
My question is I need to run three applications on port 80 on same machine but different IPs, what is the best way and how ?
Mark provided a link on how to configure different connectors. I made an effort of grokking all this server.xml configuration and have come up with two questions of my own. Please read on. You can use the following XSLT to strip your server.xml of all the helpful comments so you see that it's less frightening than it appears. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:strip-space elements="*"/><!-- tabula rasa in --> <xsl:output indent="yes"/><!-- tabula rasa out --> <xsl:template match="comment()"/><!-- weed comments --> <xsl:template match="@*|node()"><!-- identity template --> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet> So you have a <Server> . It has a couple of <Listener> elements and <GlobalNamingResources>. A server may have mulitple <Service> elements. Don't ask me why you'd want more than one <Service> elements  - because that's what I'd like to ask the experts. Anyone? Anyway, as you can see from , a <Service> "represents the combination of one or more Connector components that share a single Engine component for processing incoming requests." Define all the connectors  you want for your different IP numbers and ports. They'll all be processed by the single <Engine> , which supports virtual hosting and dispatches incoming requests (based on the HTTP Host header) to a matching virtual host, or, failing that, the default host, which is mandatory both as Engine/@defaultHost and Engine/Host/@name. As a configuration artefact, the <Host>  is decoupled from the IP numbers and only associated with DNS names or aliases. IP numbers and ports are the job of the <Connector>. Now you could nest <Context> elements defining your applications inside <Host> elements - but in Tomcat 6 this is not recommended. Now each <Host> has its place where to look for applications, which is configured in Host/@appBase. That's where you put your WAR files. Here's my second question: Say I have various <Connector> bindings set up receiving requests and dispatching them to my single <Engine>, which has three hosts alpha, beta and gamma. What would be the best way to associate my shiny new second-world.war with all of alpha, beta and gamma? (1) By dropping a copy in each of the different Host/@appBase? (2) By having all three Host/@appBase point to the same location (and then of course put the WAR there)? (3) By some other means? -- Michael Ludwig  http://tomcat.apache.org/tomcat-6.0-doc/config/server.html  http://tomcat.apache.org/tomcat-6.0-doc/config/service.html  http://tomcat.apache.org/tomcat-6.0-doc/config/http.html  http://tomcat.apache.org/tomcat-6.0-doc/config/engine.html  http://tomcat.apache.org/tomcat-6.0-doc/config/host.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org