Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Does WTP support Tomcat servers with multiple Service elements in server.xml?(WTP fails to _completely_ start Tomcat with server.xml with multiple Service elements, one of which is AJP connector?)
Does WTP support Tomcat servers with multiple Service elements in server.xml? [message #489580] Mon, 05 October 2009 06:42 Go to next message
O  is currently offline O
Messages: 4
Registered: July 2009
Junior Member
Hi,

I've been using WTP and Tomcat successfully for a couple of years now. Everything's worked fine with a single Service with 1-HTTP Connector on 8080 and 1-AJP Connector on 8009.
We recently decided to split up our webapps across multiple ports. The implementation we chose was to create multiple Service elements, in our server.xml, with each of them containing a single Connector. Also, each Service->Engine->Host element uses a different "appBase" attribute. Two of the Connectors are HTTP and 1 is AJP. Tomcat starts up fine externally (outside of eclipse) with this configuration.
When I create a new WTP Server out of this configuration however, Eclipse can't start it up. The 'console' output indicates that Tomcat actually did start up, i.e. "INFO: Server startup in 400 ms". 'netstat' indicates that the ports were actually bound to. However, the Server's view still shows the flashing "Starting..." icon and then it "times out" with the error: "Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor."

1) Is a server.xml that contains multiple Service elements supported in WTP?

To make things interesting, I changed the AJP port to HTTP, so that each Service now had an HTTP Connector element, and WTP _was_ able to successfully start Tomcat. It just seems to be a problem when it's AJP.

2) What else does WTP do _after_ Tomcat has been started, but _before_ WTP reports that it's been started? I know it's doing something because in mucking with the configuration, I was able to get it to generate "Bad Packet Signature 18245" errors. Is there a log file somewhere that reports on what's happening and more importantly what's failing?

I've googled but haven't found any info on how to get this to work. Any help would be greatly appreciated.

Thanks,
O

Environment:
Apache Tomcat 6.0.14
Server Runtime Environment uses MacOSX JDK 1.6.0_15
Eclipse Ganymede 3.4.1 Build id: M20080911-1700
Mac OSX 10.5.8

server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
  <Listener SSLEngine="off" className="org.apache.catalina.core.AprLifecycleListener"/>
  <Listener className="org.apache.catalina.core.JasperListener"/>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <GlobalNamingResources>
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
  </GlobalNamingResources>
  <Service name="BackendService">
    <Connector acceptCount="100" disableUploadTimeout="true" enableLookups="false" maxSpareThreads="75" maxThreads="200" minSpareThreads="5" port="8080" scheme="http"/>
    <Engine defaultHost="localhost" name="BackendEngine">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
        <Host appBase="backendapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
        </Host>
    </Engine>
  </Service>

  <Service name="LocalService">
    <Connector acceptCount="100" disableUploadTimeout="true" enableLookups="false" maxSpareThreads="75" maxThreads="200" minSpareThreads="5" port="8090" scheme="http"/>
    <Engine defaultHost="localhost" name="LocalEngine">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
        <Host appBase="localapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
        </Host>
    </Engine>
  </Service>

  <Service name="Catalina">
    <Connector backlog="100" enableLookups="false" maxThreads="200" port="8009" scheme="http" protocol="AJP/1.3" />
    <Engine defaultHost="localhost" name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
      </Host>
    </Engine>
  </Service>

</Server>

[Updated on: Mon, 05 October 2009 06:43]

Report message to a moderator

Re: Does WTP support Tomcat servers with multiple Service elements in server.xml? [message #489721 is a reply to message #489580] Mon, 05 October 2009 16:37 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1308
Registered: July 2009
Senior Member
There really isn't much in the way of "support" for multiple <Service>
elements. Instead, what is currently implemented is more like default
behavior in the presence of multiple <Service> elements. The WTP Tomcat
support only knows how to "use" a one <Service>. It picks that one
using the following sequence (which applies to Tomcat 4.0.x through 6.0.x):

1. If there is a service named "Catalina", it will use that one.
2. If there is a service named "Tomcat-Standalone", it will use that one.
3. Use the first <service> found.

Once a service is picked, a <Host> must be picked. It will pick one
named "localhost" if found, or the first <Host> if not.

Your difficultly likely stems from #1 above. Try changing the
"Catalina" name to something else, then arrange the <Service> elements
to have the one you want WTP to use first. This isn't a heavily tested
scenario (hardly tested is probably more accurate), so post back if this
doesn't work or new problems are encountered.

Cheers,
Larry

O wrote:
>
> Hi,
>
> I've been using WTP and Tomcat successfully for a couple of years now.
> Everything's worked fine with a single Service with 1-HTTP Connector on
> 8080 and 1-AJP Connector on 8009. We recently decided to split up our
> webapps across multiple ports. The implementation we chose was to create
> multiple Service elements, in our server.xml, with each of them
> containing a single Connector. Also, each Service->Engine->Host element
> uses a different "appBase" attribute. Two of the Connectors are HTTP and
> 1 is AJP. Tomcat starts up fine externally (outside of eclipse) with
> this configuration.
> When I create a new WTP Server out of this configuration however,
> Eclipse can't start it up. The 'console' output indicates that Tomcat
> actually did start up, i.e. "INFO: Server startup in 400 ms". 'netstat'
> indicates that the ports were actually bound to. However, the Server's
> view still shows the flashing "Starting..." icon and then it "times out"
> with the error: "Server Tomcat v6.0 Server at localhost was unable to
> start within 45 seconds. If the server requires more time, try
> increasing the timeout in the server editor."
>
> 1) Is a server.xml that contains multiple Service elements supported in
> WTP?
>
> To make things interesting, I changed the AJP port to HTTP, so that each
> Service now had an HTTP Connector element, and WTP _was_ able to
> successfully start Tomcat. It just seems to be a problem when it's AJP.
>
> 2) What else does WTP do _after_ Tomcat has been started, but _before_
> WTP reports that it's been started? I know it's doing something because
> in mucking with the configuration, I was able to get it to generate "Bad
> Packet Signature 18245" errors. Is there a log file somewhere that
> reports on what's happening and more importantly what's failing?
>
> I've googled but haven't found any info on how to get this to work. Any
> help would be greatly appreciated.
>
> Thanks,
> O
>
> Environment:
> Apache Tomcat 6.0.14
> Server Runtime Environment uses MacOSX JDK 1.6.0_15
> Eclipse Ganymede 3.4.1 Build id: M20080911-1700
> Mac OSX 10.5.8
>
> server.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Server port="8005" shutdown="SHUTDOWN">
> <Listener SSLEngine="off"
> className="org.apache.catalina.core.AprLifecycleListener"/ >
> <Listener className="org.apache.catalina.core.JasperListener"/>
> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener "/>
> <Listener
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener "/>
> <GlobalNamingResources>
> <Resource auth="Container" description="User database that can be
> updated and saved"
> factory="org.apache.catalina.users.MemoryUserDatabaseFactory "
> name="UserDatabase" pathname="conf/tomcat-users.xml"
> type="org.apache.catalina.UserDatabase"/>
> </GlobalNamingResources>
> <Service name="BackendService">
> <Connector acceptCount="100" disableUploadTimeout="true"
> enableLookups="false" maxSpareThreads="75" maxThreads="200"
> minSpareThreads="5" port="8080" scheme="http"/>
> <Engine defaultHost="localhost" name="BackendEngine">
> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="UserDatabase"/>
> <Host appBase="backendapps" autoDeploy="true" name="localhost"
> unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
> </Host>
> </Engine>
> </Service>
>
> <Service name="LocalService">
> <Connector acceptCount="100" disableUploadTimeout="true"
> enableLookups="false" maxSpareThreads="75" maxThreads="200"
> minSpareThreads="5" port="8090" scheme="http"/>
> <Engine defaultHost="localhost" name="LocalEngine">
> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="UserDatabase"/>
> <Host appBase="localapps" autoDeploy="true" name="localhost"
> unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
> </Host>
> </Engine>
> </Service>
>
> <Service name="Catalina">
> <Connector backlog="100" enableLookups="false" maxThreads="200"
> port="8009" scheme="http" protocol="AJP/1.3" />
> <Engine defaultHost="localhost" name="Catalina">
> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="UserDatabase"/>
> <Host appBase="webapps" autoDeploy="true" name="localhost"
> unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
> </Host>
> </Engine>
> </Service>
>
> </Server>
>
Re: Does WTP support Tomcat servers with multiple Service elements in server.xml? [message #489785 is a reply to message #489580] Mon, 05 October 2009 22:40 Go to previous message
O  is currently offline O
Messages: 4
Registered: July 2009
Junior Member
Thanks Larry!

Very helpful information. Here's what I ended up doing:

* I renamed the "Catalina" Service to "CatalinaAJP" as well as it's Engine subelement.
* I reordered the Services, such that the one that hosts the webapps I work on is listed first, of course.
* Unfortunately, to deploy a webapp to a Service other than the first, I had to manually move the WTP created Context element from the first Service to the Service I want it at. Fortunately, once moved, the Context stayed under the new Service. That is, this manual modification of the server.xml only has to be done once, for each webapp.
* Lastly, because each Service has its own Host with a unique "appBase" attribute, I had to create a symlink named the "appBase" value to "wtpwebapps". i.e 'ln -s wtpwebapps <appBaseValue>'

Thanks again.
Previous Topic:Index search for Java EE metadata
Next Topic:problem publishing web project into tomcat installation if output folder is WebContent/WEB-INF/class
Goto Forum:
  


Current Time: Wed Oct 01 00:07:04 GMT 2014

Powered by FUDForum. Page generated in 0.02012 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software