Tomcat launches multiple ports for multiple Web applications

Source: Internet
Author: User
Tags server port

Tomcat's boot profile is Tomcat/conf/server.xml, and a service is configured by default:

<?xml version= "1.0" encoding= "UTF-8"? ><server port= "8005" shutdown= "shutdown" > <listener classname= " Org.apache.catalina.startup.VersionLoggerListener "/> <listener classname=" Org.apache.catalina.core.AprLifecycleListener "sslengine=" on "/> <listener classname=" Org.apache.catalina.core.JreMemoryLeakPreventionListener "/> <listener classname=" Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener "/> <listener classname=" Org.apache.catalina.core.ThreadLocalLeakPreventionListener "/> <GlobalNamingResources> <resource name= "Userdatabase" auth= "Container" type= "Org.apache.catalina.UserDatabase" description= "User Databa              SE, can be updated and saved "factory=" Org.apache.catalina.users.MemoryUserDatabaseFactory " Pathname= "Conf/tomcat-users.xml"/> </GlobalNamingResources> <service name= "Catalina" > <connector            port= "8080" protocol= "http/1.1"   connectiontimeout= "20000" redirectport= "8443"/> <connector port= "8009" protocol= "AJP/1.3" redir ectport= "8443"/> <engine name= "Catalina" defaulthost= "localhost" > <realm classname= "Org.apache.catali Na.realm.LockOutRealm "> <realm classname=" Org.apache.catalina.realm.UserDatabaseRealm "Resource Name= "Userdatabase"/> </Realm> 

Of course, the context element inside the host is my Config Web project Plus, the Docbase property value points to the Web app that needs to be started, the value of the Path property specifies the path namespace to access, and I'm accustomed to the empty string

<Context docBase="" path="" />

Now requires two applications, need to configure a service, need to ensure that the Service Name property is not the same, while guaranteeing two child elements connector HTTP port and AJP listening port does not conflict with the port of the previous application

Another service configuration is added as follows,

 <Service name="ZeroHome"> <Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8444" /> <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> <Context docBase="" path="" /> </Host> </Engine> </Service>

However, two Web apps did start up, and observing log files had an error message.

SEVERE: Creation of the naming context failed: [javax.naming.OperationNotSupportedException: Context is read only]

After trying a few times, I found out
After changing the Engine element's Name property to be different from the first one, the error disappears and the two Web launch succeeds.

<Engine name="Catalina2" defaultHost="localhost">

The specific reason for the error is still looking for

Tomcat launches multiple ports for multiple Web applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.