Deploying multiple projects under Tomcat

Multiple project deployments with the same port number Ad...

Multiple project deployments with the same port number

Add:

  1. <Context path="/route" reloadable="true" docBase="/home/develop/tomcat-7.0.54/flatrass"/>
  2. <Context path="/route2" reloadable="true" docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>
By visiting: http://127.0.0.1:8080/route http://127.0.0.1:8080/route2 Items corresponding to each child


Multiple project deployments for different port numbers

By visiting: http://127.0.0.1:8080/route http://127.0.0.1:8081/route Items for each child
Open conf folderServer.xmlFile, add

  1. <Context path="/route" reloadable="true" docBase="/home/develop/tomcat-7.0.54/flatrass"/>


Put a service label under the service label.Copy the service above and modify the port number inside to 8081.Add to:

  1. <Context path="/route" reloadable="true" docBase="/home/develop/tomcat-7.0.54/flatrasweats"/>


  1. <?xml version='1.0' encoding='utf-8'?>
  2. <Server port="8054" shutdown="SHUTDOWN">
  3. <!-- Security listener. Documentation at /docs/config/listeners.html <Listener
  4. className="org.apache.catalina.security.SecurityListener" /> -->
  5. <!--APR library loader. Documentation at /docs/apr.html -->
  6. <Listener className="org.apache.catalina.core.AprLifecycleListener"
  7. SSLEngine="on" />
  8. <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  9. <Listener className="org.apache.catalina.core.JasperListener" />
  10. <!-- Prevent memory leaks due to use of particular java/javax APIs -->
  11. <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  12. <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  13. <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  14. <GlobalNamingResources>
  15. <Resource name="UserDatabase" auth="Container"
  16. type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
  17. factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
  18. pathname="conf/tomcat-users.xml" />
  19. </GlobalNamingResources>
  20. <Service name="Catalina">
  21. <!--protocol Please use nio2,perhaps apr -->
  22. <Connector port="8080" protocol="HTTP/1.1"
  23. connectionTimeout="20000" redirectPort="9543" />
  24. <Connector port="8909" protocol="AJP/1.3" redirectPort="9543" />
  25. <Engine name="Catalina" defaultHost="localhost">
  26. <Realm className="org.apache.catalina.realm.LockOutRealm">
  27. <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  28. resourceName="UserDatabase" />
  29. </Realm>
  30. <Host name="localhost" appBase="webapps" unpackWARs="true"
  31. autoDeploy="true">
  32. <Valve className="org.apache.catalina.valves.AccessLogValve"
  33. directory="logs" prefix="localhost_access_log." suffix=".txt"
  34. pattern="%h %l %u %t "%r" %s %b"/>
  35. <Context path="/route" reloadable="true"
  36. docBase="/home/develop/tomcat-7.0.54/flatrass" />
  37. </Host>
  38. </Engine>
  39. </Service>
  40. <Service name="Catalina">
  41. <!--hold port Change to 8081 -->
  42. <!--protocol Please use nio2,perhaps apr -->
  43. <Connector port="8081" protocol="HTTP/1.1"
  44. connectionTimeout="20000" redirectPort="9543" />
  45. <Connector port="8909" protocol="AJP/1.3" redirectPort="9543" />
  46. <Engine name="Catalina" defaultHost="localhost">
  47. <Realm className="org.apache.catalina.realm.LockOutRealm">
  48. <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  49. resourceName="UserDatabase" />
  50. </Realm>
  51. <Host name="localhost" appBase="webapps" unpackWARs="true"
  52. autoDeploy="true">
  53. <Valve className="org.apache.catalina.valves.AccessLogValve"
  54. directory="logs" prefix="localhost_access_log." suffix=".txt"
  55. pattern="%h %l %u %t "%r" %s %b"/>
  56. <Context path="/route" reloadable="true"
  57. docBase="/home/develop/tomcat-7.0.54/flatrasweats" />
  58. </Host>
  59. </Engine>
  60. </Service>
  61. </Server>

java home set :

setclasspath.sh

export JAVA_HOME=/home/qatest/jdk1.8.0_91export JRE_HOME=/home/qatest/jdk1.8.0_91/jre

Web.xmlThe loading process is:

context-param -> listener -> filter -> servlet
Other:
service httpd status service httpd restart lsof -i:80 chmod +x catalina.sh ps –ef|grep tomcat rm –rf file
Start tomcat #. /startup.sh
Close tomcat #. /shutdown.sh
To see if the startup was successful, type ps axuwf|grep java.
If a lot of results occur, the boot is successful. You can also netstat-lnpt to see if port 8088 is in use. If used, the boot is successful.

18 July 2020, 11:33 | Views: 3359

Add new comment

For adding a comment, please log in
or create account

0 comments