Install Java and Apache Tomcat (Windows)
1. If you are using AzureSQL for your database, go to Using Azure SQL Server as the Persistence Provider. Perform the steps in that section to set up the database, and you will be referred back to this section.
2. If you are using MSSQL for your database, go to Using MSSQL as the Persistence Provider . Perform the steps in that section to set up the database, and you will be referred back to this section.
3. Refer to the ThingWorx System Requirements for Java JDK version requirements.
4. Download and install the required version of the Java JDK from the Oracle website.
5. Ensure the Java environment variable is configured properly :
1. Locate your Java installation directory and copy the path. The default path is C:\Program Files\Java\jdk_<version number>.
2. From the Windows start menu, navigate to Advanced System Properties. Your path to these properties will vary based on your version of Windows. For example, for Windows 10, search for Environment Variables then select Edit the system environment variables.
3. Click Environment Variables.
4. In the System variables section, click New.
5. In the Variable name field, enter JAVA_HOME.
6. In the Variable value field, enter the path to your Java installation as defined in step a.
7. Click OK.
6. Refer to the ThingWorx System Requirements for Apache Tomcat version requirements.
7. Visit the Tomcat website to download the 32-bit/64-bit Windows Service Installer (pgp, sha1, sha512).
* 
Best practice includes verifying the integrity of the Tomcat file by using the signatures or checksums for each release. Refer to Apache’s documentation for more information.
8. The Apache Tomcat Setup Wizard launches. Click Next.
9. Click I Agree.
10. In the Choose Components section, use the default settings. Click Next.
11. In the HTTP/1.1 Connector Port field, type 80 (or other available port).
12. In the Tomcat Administrator Login fields, you must enter a Tomcat user name and a unique, secure password for Tomcat administration. In ThingWorx it is required, not optional.
13. Click Next.
14. Click Next.
15. Click Install.
16. Click Finish.
17. Launch 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 options field:
-Dserver -Dd64
-XX:+UseG1GC
-Dfile.encoding=UTF-8
-Djava.library.path=<path to Tomcat>\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
If you are installing the ThingWorx Platform for the first time, the Java option -Duser.timezone=UTC should be set, where UTC does not recognize daylight savings time. Setting this option prevents overwriting data when daylight savings time changes occur. Existing customers should not update this setting at this time.
* 
For more information on these options and for additional options for hosted and/or public-facing environments, refer to the Apache Tomcat Java Option Settings.
19. Set the Initial memory pool and Maximum memory pool fields to 75% of the available OS memory (for example, 12GB for a 16GB RAM system). Refer to JVM Tuning for additional information.
20. Click OK
21. In the location of the Tomcat installation, open /conf/web.xml. Replace the default error page (default is stacktrace) by adding the following into the web.xml file. Place the following within the web-app tag (after the welcome-file-list tag ). A well-configured web application will override this default in webapps/APP_NAME/WEB-INF/web.xml so it won't cause problems.
<error-page><exception-type>java.lang.Throwable</exception-type><location>/error.jsp</location></error-page>
22. In the location of the Tomcat installation, open conf/server.xml. Add the following inside the <Host> </Host> tags:
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false" />
* 
For security reasons, it is critical that you disable the AJP connector, if not already done so by default, by performing the following step.
23. In the location of the Tomcat installation, open conf/server.xml and search for the following line. If found, 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 defaults to true. Manually modifying the conf/web.xml file to set this attribute to false is not recommended or supported by PTC.
24. Remove all the Tomcat webapps located in /<path_to_tomcat>/webapps/. Removing these apps prevents unnecessary access to Tomcat, specifically in the context that would allow users to view other users' cookies.
25. If your application requires a specific cipher suite, refer to the following documentation for configuration information:
26. PTC strongly recommends the use of TLS when running ThingWorx. For detailed instructions on setting up TLS, refer to this technical support article.
27. (OPTIONAL STEP) To increase the default cache settings that affect static file caching, add the following line within the <context></context> tags in the $CATALINA_HOME/conf/context.xml file:
<Resources cacheMaxSize="501200" cacheObjectMaxSize="2048" cacheTtl="60000"/>
Increasing this setting improves performance and avoids 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.
Was this helpful?