Re: Two Service elements problems
I couldn't find it in your post, so let me ask. Do you have 2 network interfaces on the machine? How are you establishing 2 ip addresses? This topic sparked my interest because I will also be doing the same thing. Now, to answer your question more definitively.I put together a mock setup using a 5.0.30 distro I had laying around (WinXP). I took the default server.xml listening on localhost and added the following service element: Service name=Catalina2 Connector port=8081 address=littlehost maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true / !-- Define the top level container in our container hierarchy -- Engine name=Catalina2 defaultHost=littlehost debug=0 !-- Global logger unless overridden at lower levels -- Logger className=org.apache.catalina.logger.FileLogger prefix=catalina_log. suffix=.txt timestamp=true/ Host name=littlehost debug=0 appBase=l_webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=littlehost_log. suffix=.txt timestamp=true/ /Host /Engine /Service I don't have a second network interface, so created a second host name littlehost to my actual ip address through /etc/hosts. Started tomcat . , my netstat confirmed that I was listening to port 8080 on localhost and port 8081 on littlehost. But, when I go to http://littlehost:8081/ nothing happened. Then I followed the directions at http://www.ex-parrot.com/~pete/tomcat-vhost.html for setting up a virtual host. Using that reference I did this: 1. Added a ROOT.xml file in conf/Catalina2/littlehost 2 Created the l_webapps directory specified by my Host element. 3. Created a web application deployment structure in the l_webapps directory 4. Created an index.jsp at the root of l_webapps Restarted tomcat .. now http://littlehost:8081/ servers up content. Good Luck Steve Barnett, Brian W. wrote: netstat -an results (snippet) Proto Local Address Foreign AddressState TCP166.70.163.138:80 0.0.0.0:0 LISTENING TCP166.70.163.138:139 0.0.0.0:0 LISTENING TCP166.70.163.138:2109166.70.163.131:2433ESTABLISHED TCP166.70.163.138:2110166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2113166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2115166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2117166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2119166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2122166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2125166.70.163.131:2433ESTABLISHED TCP166.70.163.138:338963.253.57.180:4881 ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2110ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2113ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2115ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2117ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2119ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2122ESTABLISHED UDP166.70.163.138:123 *:* UDP166.70.163.138:137 *:* UDP166.70.163.138:138 *:* UDP166.70.163.138:520 *:* UDP166.70.163.140:123 *:* UDP166.70.163.140:520 *:* UDP166.70.163.140:1900*:* No TCP info for 166.70.163.140, only UDP info. Not sure where to turn for help on this one. I'm not a network guy :( Any suggestions? -Original Message- From: Steve Dodge [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 14, 2005 12:32 PM To: Tomcat Users List Subject: Re: Two Service elements problems If you do a netstat -ln (cygwin) do you see two network sockets listening on port 80? 166.70.163.138:80 166.70.163.140:80 If not, the problem is at a lower level than tomcat. Steve Barnett, Brian W. wrote: I have two Service elements defined like this in my server.xml file, each one listening to a different IP address and serving requests for different web sites. (Using 5.0.28) Service name=MyService1 Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true address=166.70.163.138 / Connector port=443 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false disableUploadTimeout=true acceptCount=100 debug=0 scheme=https secure=true clientAuth=false sslProtocol=TLS address=166.70.163.138 / Engine name=Catalina1 defaultHost=host1 debug=0 Host name=host1 debug=0 appBase=/webapps/host1 unpackWARs=true autoDeploy=true
RE: Two Service elements problems
Thanks Steve. I will try that. Regarding your question to me, I have tried two different approaches. My first approach was to bind an additional IP address to the one NIC I had in the XP box using the Advanced button in TCP/IP setup for the NIC. I struggled through that for a few days, then decided to put in a second NIC. I struggled to get that working for a few days and ended up going to back to two IPs bound to a single NIC. Since I have not yet got it working the way I want it to work, I can not say definitively whether either of those approaches worked, although from my research either *should* work. There are advantages/disadvantages to each. Things to consider are bandwidth sharing, if a NIC goes down you lose both IPs or just one, etc. Again, thanks for your input! Brian -Original Message- From: Steve Dodge [mailto:[EMAIL PROTECTED] Sent: Thursday, September 15, 2005 2:40 PM To: Tomcat Users List Subject: Re: Two Service elements problems I couldn't find it in your post, so let me ask. Do you have 2 network interfaces on the machine? How are you establishing 2 ip addresses? This topic sparked my interest because I will also be doing the same thing. Now, to answer your question more definitively.I put together a mock setup using a 5.0.30 distro I had laying around (WinXP). I took the default server.xml listening on localhost and added the following service element: Service name=Catalina2 Connector port=8081 address=littlehost maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true / !-- Define the top level container in our container hierarchy -- Engine name=Catalina2 defaultHost=littlehost debug=0 !-- Global logger unless overridden at lower levels -- Logger className=org.apache.catalina.logger.FileLogger prefix=catalina_log. suffix=.txt timestamp=true/ Host name=littlehost debug=0 appBase=l_webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=littlehost_log. suffix=.txt timestamp=true/ /Host /Engine /Service I don't have a second network interface, so created a second host name littlehost to my actual ip address through /etc/hosts. Started tomcat . , my netstat confirmed that I was listening to port 8080 on localhost and port 8081 on littlehost. But, when I go to http://littlehost:8081/ nothing happened. Then I followed the directions at http://www.ex-parrot.com/~pete/tomcat-vhost.html for setting up a virtual host. Using that reference I did this: 1. Added a ROOT.xml file in conf/Catalina2/littlehost 2 Created the l_webapps directory specified by my Host element. 3. Created a web application deployment structure in the l_webapps directory 4. Created an index.jsp at the root of l_webapps Restarted tomcat .. now http://littlehost:8081/ servers up content. Good Luck Steve Barnett, Brian W. wrote: netstat -an results (snippet) Proto Local Address Foreign AddressState TCP166.70.163.138:80 0.0.0.0:0 LISTENING TCP166.70.163.138:139 0.0.0.0:0 LISTENING TCP166.70.163.138:2109166.70.163.131:2433ESTABLISHED TCP166.70.163.138:2110166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2113166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2115166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2117166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2119166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2122166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2125166.70.163.131:2433ESTABLISHED TCP166.70.163.138:338963.253.57.180:4881 ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2110ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2113ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2115ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2117ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2119ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2122ESTABLISHED UDP166.70.163.138:123 *:* UDP166.70.163.138:137 *:* UDP166.70.163.138:138 *:* UDP166.70.163.138:520 *:* UDP166.70.163.140:123 *:* UDP166.70.163.140:520 *:* UDP166.70.163.140:1900*:* No TCP info for 166.70.163.140, only UDP info. Not sure where to turn for help on this one. I'm not a network guy :( Any suggestions? -Original Message- From: Steve Dodge [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 14, 2005 12:32 PM To: Tomcat Users List Subject: Re: Two Service elements problems If you do
Re: Two Service elements problems
Brian, On more follow up. I found a usb wireless network adapter that I forgot I had. The server.xml snippet below stayed the same, except I had to add the address attribute on the original http connector element. I opted to use the Ip addresses instead of messing with /etc/hosts this time. Now I have . Service name=Catalina Connector port=8080 address=192.168.0.2 etc etc... Service name=Catalina2 Connector port=8080 address=192.168.0.5 etc etc... netstat -an (snippet) TCP192.168.0.2:8080 0.0.0.0:0 LISTENING TCP192.168.0.5:1390.0.0.0:0 LISTENING TCP192.168.0.5:8080 0.0.0.0:0 LISTENING It serves content on both IP addresses with the same port. Steve Barnett, Brian W. wrote: Thanks Steve. I will try that. Regarding your question to me, I have tried two different approaches. My first approach was to bind an additional IP address to the one NIC I had in the XP box using the Advanced button in TCP/IP setup for the NIC. I struggled through that for a few days, then decided to put in a second NIC. I struggled to get that working for a few days and ended up going to back to two IPs bound to a single NIC. Since I have not yet got it working the way I want it to work, I can not say definitively whether either of those approaches worked, although from my research either *should* work. There are advantages/disadvantages to each. Things to consider are bandwidth sharing, if a NIC goes down you lose both IPs or just one, etc. Again, thanks for your input! Brian -Original Message- From: Steve Dodge [mailto:[EMAIL PROTECTED] Sent: Thursday, September 15, 2005 2:40 PM To: Tomcat Users List Subject: Re: Two Service elements problems I couldn't find it in your post, so let me ask. Do you have 2 network interfaces on the machine? How are you establishing 2 ip addresses? This topic sparked my interest because I will also be doing the same thing. Now, to answer your question more definitively.I put together a mock setup using a 5.0.30 distro I had laying around (WinXP). I took the default server.xml listening on localhost and added the following service element: Service name=Catalina2 Connector port=8081 address=littlehost maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true / !-- Define the top level container in our container hierarchy -- Engine name=Catalina2 defaultHost=littlehost debug=0 !-- Global logger unless overridden at lower levels -- Logger className=org.apache.catalina.logger.FileLogger prefix=catalina_log. suffix=.txt timestamp=true/ Host name=littlehost debug=0 appBase=l_webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=littlehost_log. suffix=.txt timestamp=true/ /Host /Engine /Service I don't have a second network interface, so created a second host name littlehost to my actual ip address through /etc/hosts. Started tomcat . , my netstat confirmed that I was listening to port 8080 on localhost and port 8081 on littlehost. But, when I go to http://littlehost:8081/ nothing happened. Then I followed the directions at http://www.ex-parrot.com/~pete/tomcat-vhost.html for setting up a virtual host. Using that reference I did this: 1. Added a ROOT.xml file in conf/Catalina2/littlehost 2 Created the l_webapps directory specified by my Host element. 3. Created a web application deployment structure in the l_webapps directory 4. Created an index.jsp at the root of l_webapps Restarted tomcat .. now http://littlehost:8081/ servers up content. Good Luck Steve Barnett, Brian W. wrote: netstat -an results (snippet) Proto Local Address Foreign AddressState TCP166.70.163.138:80 0.0.0.0:0 LISTENING TCP166.70.163.138:139 0.0.0.0:0 LISTENING TCP166.70.163.138:2109166.70.163.131:2433ESTABLISHED TCP166.70.163.138:2110166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2113166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2115166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2117166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2119166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2122166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2125166.70.163.131:2433ESTABLISHED TCP166.70.163.138:338963.253.57.180:4881 ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2110ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2113ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2115
Re: Two Service elements problems
If you do a netstat -ln (cygwin) do you see two network sockets listening on port 80? 166.70.163.138:80 166.70.163.140:80 If not, the problem is at a lower level than tomcat. Steve Barnett, Brian W. wrote: I have two Service elements defined like this in my server.xml file, each one listening to a different IP address and serving requests for different web sites. (Using 5.0.28) Service name=MyService1 Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true address=166.70.163.138 / Connector port=443 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false disableUploadTimeout=true acceptCount=100 debug=0 scheme=https secure=true clientAuth=false sslProtocol=TLS address=166.70.163.138 / Engine name=Catalina1 defaultHost=host1 debug=0 Host name=host1 debug=0 appBase=/webapps/host1 unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host /Engine /Service Service name=MyService2 Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true address=166.70.163.140 / Connector port=443 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false disableUploadTimeout=true acceptCount=100 debug=0 scheme=https secure=true clientAuth=false sslProtocol=TLS address=166.70.163.140 / Engine name=Catalina2 defaultHost=host2 debug=0 Host name=host2 debug=0 appBase=/webapps/host2 unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host /Engine /Service My Tomcat folder structure looks like this: conf --Catalina1 host1 --[various .xml files (context files)] --Catalina2 host2 --[various .xml files (context files)] webapps --host1 [various webapps] --host2 [various webapps] I can browse successfully to all the web apps that are deployed in webapps/host1 but when I browse to host 2 I get the following error: (Error message from Firefox when browsing to http://166.70.163.140) The connection was refused when attempting to contact 166.70.163.140. In the stdout.log file, mention is made of the context files in /Catalina1/host1 but no mention is made of context files in /Catalina2/host2. Sep 14, 2005 10:53:04 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:C:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\Catalina1\host1\admin.xml Sep 14, 2005 10:53:12 AM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true Sep 14, 2005 10:53:12 AM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true Sep 14, 2005 10:53:13 AM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true Sep 14, 2005 10:53:18 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:C:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\Catalina1\host1\balancer.xml Sep 14, 2005 10:53:19 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:C:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\Catalina1\host1\gapay.xml Sep 14, 2005 10:53:23 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:C:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\Catalina1\host1\manager.xml Sep 14, 2005 10:53:23 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:C:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\Catalina1\host1\webshare.xml I wondered if 166.70.163.140 was accessible at all, so I just tried having one Service defined without specifying an IP address. Both IPs were accessible in this case, so I assumed 166.70.163.140 was configured correctly. I tried it with and without Windows XP firewall enabled and got same results. Can someone shed some light on what could be the problem(s)? Thanks, Brian Barnett This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Two Service elements problems
netstat -an results (snippet) Proto Local Address Foreign AddressState TCP166.70.163.138:80 0.0.0.0:0 LISTENING TCP166.70.163.138:139 0.0.0.0:0 LISTENING TCP166.70.163.138:2109166.70.163.131:2433ESTABLISHED TCP166.70.163.138:2110166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2113166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2115166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2117166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2119166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2122166.70.163.138:8093ESTABLISHED TCP166.70.163.138:2125166.70.163.131:2433ESTABLISHED TCP166.70.163.138:338963.253.57.180:4881 ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2110ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2113ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2115ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2117ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2119ESTABLISHED TCP166.70.163.138:8093166.70.163.138:2122ESTABLISHED UDP166.70.163.138:123 *:* UDP166.70.163.138:137 *:* UDP166.70.163.138:138 *:* UDP166.70.163.138:520 *:* UDP166.70.163.140:123 *:* UDP166.70.163.140:520 *:* UDP166.70.163.140:1900*:* No TCP info for 166.70.163.140, only UDP info. Not sure where to turn for help on this one. I'm not a network guy :( Any suggestions? -Original Message- From: Steve Dodge [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 14, 2005 12:32 PM To: Tomcat Users List Subject: Re: Two Service elements problems If you do a netstat -ln (cygwin) do you see two network sockets listening on port 80? 166.70.163.138:80 166.70.163.140:80 If not, the problem is at a lower level than tomcat. Steve Barnett, Brian W. wrote: I have two Service elements defined like this in my server.xml file, each one listening to a different IP address and serving requests for different web sites. (Using 5.0.28) Service name=MyService1 Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true address=166.70.163.138 / Connector port=443 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false disableUploadTimeout=true acceptCount=100 debug=0 scheme=https secure=true clientAuth=false sslProtocol=TLS address=166.70.163.138 / Engine name=Catalina1 defaultHost=host1 debug=0 Host name=host1 debug=0 appBase=/webapps/host1 unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host /Engine /Service Service name=MyService2 Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true address=166.70.163.140 / Connector port=443 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false disableUploadTimeout=true acceptCount=100 debug=0 scheme=https secure=true clientAuth=false sslProtocol=TLS address=166.70.163.140 / Engine name=Catalina2 defaultHost=host2 debug=0 Host name=host2 debug=0 appBase=/webapps/host2 unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host /Engine /Service My Tomcat folder structure looks like this: conf --Catalina1 host1 --[various .xml files (context files)] --Catalina2 host2 --[various .xml files (context files)] webapps --host1 [various webapps] --host2 [various webapps] I can browse successfully to all the web apps that are deployed in webapps/host1 but when I browse to host 2 I get the following error: (Error message from Firefox when browsing to http://166.70.163.140) The connection was refused when attempting to contact 166.70.163.140. In the stdout.log file, mention is made of the context files in /Catalina1/host1 but no mention is made of context files in /Catalina2/host2. Sep 14, 2005 10:53:04 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:C:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\Catalina1\host1\admin.xml Sep 14, 2005 10:53:12 AM org.apache.struts.util.PropertyMessageResources init INFO