How do I install an APAChe Tomcat

Install Java and Apache Tomcat (Windows)

1. If you are using AzureSQL for your database, see Using Azure SQL Server as a persistence provider. Follow the steps in this section to set up the database and you will be referred back to this section.

2. If you are using MSSQL for your database, see Using Microsoft SQL Server as the Persistence Provider. Follow the steps in this section to set up the database and you will be referred back to this section.

3. For Java JDK version requirements, see ThingWorx System Requirements.

4. Download and install the required version of the Java JDK from the Oracle website.

5. Make sure that the Java environment variable is configured correctly:

1. Find the Java installation directory and copy the path. The default path is C: \ Program Files \ Java \ jdk_ .

2. Navigate to the advanced system settings in the Windows Start menu. The path to these properties varies depending on your version of Windows. For example, on Windows 10, find Environment Variables, and then select Edit System Environment Variables.

3. Click Environment Variables.

4. In the System Variables section, click New.

5. Enter JAVA_HOME in the Name of the variable field.

6. In the Value of the variable field, enter the path to your Java installation determined in step a.

7. Click OK.

6. For Apache Tomcat version requirements, see ThingWorx system requirements.

7. Visit the Tomcat website to download the 32-bit / 64-bit Windows utilities installer (pgp, sha1, sha512).

 

The best practice involves verifying the integrity of the Tomcat file using the signatures or checksums for each version. See the Apache documentation for more information.

8. The Apache Tomcat setup wizard will start. Click on Next.

9. Click I Agree.

10. Use the default settings in the Choose Components area. Click on Next.

11. Enter port 80 (or another available port) in the HTTP / 1.1 Connector Port field.

12. In the Tomcat Administrator Login fields, enter a Tomcat user name and a unique, secure password for Tomcat administration. In ThingWorx, this is required, not optional.

13. Click on Next.

14. Click on Next.

15. Click Install.

16. Click on Finish.

17. Start Tomcat. Click Configure Tomcat. In the Configure Tomcat window, click the Java tab.

18. In the Java Options field, add the following to the end of the radio button:

-Dserver -Dd64
-XX: + UseG1GC
-Dfile.encoding = UTF-8
-Djava.library.path = \ webapps \ Thingworx \ WEB-INF \ extensions

 

Djava.library.path example:

-Djava.library.path = C: \ Program Files \ Apache Software Foundation \ Tomcat8.5 \ webapps \
Thingworx \ WEB-INF \ extensions

When installing the ThingWorx Platform for the first time, the Java option -Duser.timezone = UTC should be set, whereby UTC does not take account of the time change. Setting this option prevents data from being overwritten when changing from winter time to summer time or from summer time to winter time. Existing customers should not update this setting at this time.

19. Set the Initial memory pool and Maximum memory pool fields to 75% of the available operating system memory (e.g. 12GB for a 16GB RAM system). For more information, see JVM Optimization.

20. Click OK.

21. In the location of the Tomcat installation, open /conf/web.xml. Replace the default error page (the default is Stacktrace) by adding the following in the web.xml file. Place the following inside the web app tag (after the welcome-file-list tag). A well configured web application overwrites this default setting in webapps / APP_NAME / WEB-INF / web.xml so that no problems arise.

<error-page><exception-type>java.lang.Throwable</exception-type><location>/error.jsp</location></error-page>

22. In the Tomcat installation location, open conf / server.xml. Add the following between the tags:

<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false" />

 

For security reasons, it is important that you disable the AJP connector if it has not already been done by default by following the step below.

23. In the Tomcat installation location, open the conf / server.xml file and look for the following line. Then comment it out and save the file:

<Connector port ="8009" protocol="AJP/1.3" redirectPort="8443"/>

 

In Apache Tomcat 9.0 and later, the rejectIllegalHeader attribute is true by default. Manually changing the conf / web.xml file to set this attribute is not recommended or supported by PTC.

24. Remove all Tomcat webapps from / / webapps /. These apps should be removed to prevent unnecessary access to Tomcat, especially in cases where users could otherwise see other users' cookies.

25. If your application requires a specific cipher suite, refer to the following documentation for configuration information:

◦ https://www.jamf.com/jamf-nation/articles/384/configuring-supported-ciphers-for-tomcat-https-connections

26. PTC strongly recommends using TLS when running ThingWorx. For detailed instructions on setting up TLS, see this technical support article.

27. (OPTIONAL STEP) To increase the default cache settings that affect static file caching, add the following line in tags in the $ CATALINA_HOME / conf / context.xml file:

<Resources cacheMaxSize="501200" cacheObjectMaxSize="2048" cacheTtl="60000"/>

Increasing this setting will improve performance and avoid the following message in Tomcat:

WARNING: Unable to add the resource at [/Common/jquery/jquery-ui.js] to the cache
because there was insufficient
free space available after evicting expired cache entries -
consider increasing the maximum size of the cache

28. For H2 and Azure SQL: Go to Install ThingWorx.

29. For PostgreSQL: Go to Install and Configure PostgreSQL.