Best Practices for Developing Applications > Packaging and Deploying Applications Built on the ThingWorx Platform > Troubleshooting and Debugging ThingWorx Applications During Development and Packaging
Troubleshooting and Debugging ThingWorx Applications During Development and Packaging
The following section explains how to troubleshoot some issues during the extension development and deployment.
Thing Template Does Not Exist After Successful Import
If there is an issue while creating the Thing Template after importing the entities, the Thing Template may not be available in the application. However, this exception is not fatal. The most common reason for this exception is a missing JAR file that is required for the Thing Template class. For this issue, perform the following checks:
In the metadata.xml file of your extension, check the declaration for the required JAR file.
Check if the required JAR file is available in the lib/common directory of the extension.
JAR File Conflict on Import
You may get the JAR file conflict exception when your application uses a JAR file that is already loaded on the ThingWorx Platform. To fix the issue, you can remove the JAR from your metadata.xml file. However, removing the JAR from metadata file can be risky if a different version of JAR is loaded on the platform. Different versions of the same JAR can cause conflicts in the functionality. This conflict could affect your extension or the platform itself. The best solution is to try to avoid using the JAR, if possible.
Check Logs to Debug Issues When Importing an Extension
A ThingWorx application logs all its messages in the application log. When you import an extension, classes are loaded from the JAR files, entities are created, and multiple background processes are executed at the same time. Sometimes this may cause unexpected errors. The import may fail or succeed with some ThingWorx artifacts missing. For such errors, check the application log where you can find the error with an explanation of what went wrong with the import.
To get the application and other logs, use the Monitoring menu of the Composer.
Connect a Debug Port to Tomcat
The best way to debug your application is to connect a debug port to your Tomcat instance. This enables you to connect to the platform from an integrated development environment (IDE). You can add breakpoints to the code that you have uploaded. You can trigger a service, set a property, or save a Thing, and track what happens inside your code as it executes. You must upload the same code as the code in which you have breakpoints. The breakpoints you add will be associated with different lines of code and may have different values and functionality.
To add a debug port to Tomcat, you must add a Java option on startup. There are different ways to add a debug port. It depends on how you launch Tomcat. You must configure the port depending on your Tomcat and IDE setup.
Was this helpful?