Search code examples
tomcatserverweb-applicationstomcat8

Apache tomcat reloads context multiple times


I have 2 webapps running in my tomcat. Normally when I start tomcat, I can see both works fine. I need to run one webapp on another port, say 8888 and for the same purpose I have added below Service block in server.xml

<Service name="api_service">
    <Connector port="8888" protocol="HTTP/1.1" connectionTimeout="20000" />
    <Engine name="api_engine" defaultHost="localhost">
            <Host name="localhost" appBase="webapps" unpackWARs="false" autoDeploy="false">
                    <Context docBase="api.war" path="/api2" reloadable="false"/>
            </Host>
    </Engine>
</Service>

after adding this I can access service on 8888 port but in logs I can see that api webapp service context is loaded multiple times (3 in my case). How to avoid that?


Solution

  • This is resolved: If we add context/engine for existing web apps then it will get loaded twice.

    This can be handled by separating webapps into another directory.