<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: org/json/simple/parser/ParseException while importing custom extension in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/618981#M37624</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My guess would be that since it fails during import, before you execute any of your custom code, then it's not related to your proper Java code, but instead&amp;nbsp;ThingWorx cannot parse some metadata (e.g. if you include some Entities in the extension). Need to see the ZIP file to troubleshoot it better. Couple of random thoughts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Try to remove unnecessary annotations (e.g.&amp;nbsp;ThingworxBaseTemplateDefinition, aspects = {}, etc.)&lt;/LI&gt;
&lt;LI&gt;Do you really need a Thing for that? Maybe a Resource will be more adequate?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;/ Constantine&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Jul 2019 13:44:42 GMT</pubDate>
    <dc:creator>Constantine</dc:creator>
    <dc:date>2019-07-21T13:44:42Z</dc:date>
    <item>
      <title>org/json/simple/parser/ParseException while importing custom extension</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/618630#M37577</link>
      <description>&lt;P&gt;I have created a custom extension in Java to generate PDF file in thingworx using &lt;SPAN&gt;JSON&amp;nbsp;&lt;/SPAN&gt;String as input. I have used org.json.JSONObject in my java code for implementing the PDF logic. When I import the extension to Thingworx, import fails with the below error:&lt;/P&gt;
&lt;DIV class="app-main-panel"&gt;
&lt;DIV class="app-content au-target twx-splitter-container vertical"&gt;
&lt;DIV class="main-content twx-splitter-panel"&gt;
&lt;DIV class="content-router-wrapper au-target"&gt;
&lt;DIV class="monitoring-container"&gt;
&lt;DIV class="monitoring-well"&gt;
&lt;DIV class="display-main"&gt;
&lt;DIV class="log-display-data au-target twx-splitter-container horizontal"&gt;
&lt;DIV class="content-shell"&gt;
&lt;DIV&gt;&lt;STRONG&gt;[context: An unexpected server error occurred: org/json/simple/parser/ParseException][message: org/json/simple/parser/ParseException]&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;If I run the code locally with harcoded string as input, the code complies and PDF gets generated.&lt;/DIV&gt;
&lt;DIV&gt;I am puzzled because I haven't used Json Simple in my code nor the Json Parser.&lt;/DIV&gt;
&lt;DIV&gt;Below is the code for my Thing template service:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxBaseTemplateDefinition(name = "GenericThing")&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;public class CreatePDFTemplate extends Thing {&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;private static Logger _logger = LogUtilities.getInstance().getApplicationLogger(CreatePDFTemplate.class);&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;public CreatePDFTemplate() {&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;// TODO Auto-generated constructor stub&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;// Process Report PDF (using pdfbox)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxServiceDefinition(name = "CreatePDFProcessReport", description =&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;"Service to generate PDF report for Temperer", category =&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;"", isAllowOverride = false, aspects = { "isAsync:false" })&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxServiceResult(name = "Result", description = "", baseType =&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;"STRING", aspects = {}) &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;public String CreatePDFProcessReport(&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxServiceParameter(name = "temperer16K", description = "",&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;baseType = "STRING", aspects = { "isRequired:true" }) String temperer16K,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxServiceParameter(name = "tempererLOF", description = "",&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;baseType = "STRING", aspects = { "isRequired:true" }) String tempererLOF,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxServiceParameter(name = "tunnelTemp16K", description = "",&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;baseType = "STRING", aspects = { "isRequired:true" }) String tunnelTemp16K,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxServiceParameter(name = "tunnelTempLOF", description = "",&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;baseType = "STRING", aspects = { "isRequired:true" }) String tunnelTempLOF,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;@ThingworxServiceParameter(name = "LoggedUser", description = "", baseType =&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;"USERNAME", aspects = { "isRequired:true" }) String LoggedUser) throws&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;IOException, DocumentException, JSONException &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;_logger.trace("Entering Service: CreatePDFReportAtom");&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); String&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;date = dateFormat.format(new Date());&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;String DEST =&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;"C:\\ThingworxStorage\\repository\\TestProcessPDF\\ProcessReport_"+&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;LoggedUser +"_"+ date + ".pdf";&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;new ProcessReportPDFBox().createPdfProcessReport(DEST,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;temperer16K,tempererLOF,tunnelTemp16K,tunnelTempLOF);&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;_logger.trace("Exiting Service: CreatePDFReportAtom");&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;return "/Thingworx/FileRepositories/TestProcessPDF/ProcessReport_"+&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;LoggedUser +"_"+ date + ".pdf";&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="erd_scroll_detection_container erd_scroll_detection_container_animation_active"&gt;
&lt;DIV class="erd_scroll_detection_container" dir="ltr"&gt;
&lt;DIV class="erd_scroll_detection_container"&gt;
&lt;DIV&gt;
&lt;DIV&gt;Also please find the method signature of my PDF creation code:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;public void createPdfProcessReport(String dest,String temperer16K , String tempererLOF, String tunnelTemp16K,String tunnelTempLOF&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;) throws IOException, JSONException&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;{&lt;/FONT&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="erd_scroll_detection_container erd_scroll_detection_container_animation_active"&gt;
&lt;DIV class="erd_scroll_detection_container" dir="ltr"&gt;
&lt;DIV class="erd_scroll_detection_container"&gt;
&lt;DIV&gt;
&lt;DIV&gt;Any help will be greatly appreciated!&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Jul 2019 11:13:40 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/618630#M37577</guid>
      <dc:creator>kkgooner</dc:creator>
      <dc:date>2019-07-18T11:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: org/json/simple/parser/ParseException while importing custom extension</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/618705#M37589</link>
      <description>&lt;P&gt;this is a bit beyond my knowledge, but JSON objects are standard recognized within Thingworx, so I'm not sure if you can just utilize the Thingworx default capabilities in that regard.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 16:07:00 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/618705#M37589</guid>
      <dc:creator>PaiChung</dc:creator>
      <dc:date>2019-07-18T16:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: org/json/simple/parser/ParseException while importing custom extension</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/618981#M37624</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My guess would be that since it fails during import, before you execute any of your custom code, then it's not related to your proper Java code, but instead&amp;nbsp;ThingWorx cannot parse some metadata (e.g. if you include some Entities in the extension). Need to see the ZIP file to troubleshoot it better. Couple of random thoughts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Try to remove unnecessary annotations (e.g.&amp;nbsp;ThingworxBaseTemplateDefinition, aspects = {}, etc.)&lt;/LI&gt;
&lt;LI&gt;Do you really need a Thing for that? Maybe a Resource will be more adequate?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;/ Constantine&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2019 13:44:42 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/618981#M37624</guid>
      <dc:creator>Constantine</dc:creator>
      <dc:date>2019-07-21T13:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: org/json/simple/parser/ParseException while importing custom extension</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/622847#M38362</link>
      <description>&lt;P&gt;Update:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue is solved now. Apparently, removing specific exceptions in the code such as JsonException, DocumentException and replacing them with just Exception worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 17:36:10 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/622847#M38362</guid>
      <dc:creator>kkgooner</dc:creator>
      <dc:date>2019-08-19T17:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: org/json/simple/parser/ParseException while importing custom extension</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/623054#M38404</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/304054"&gt;@kkgooner&lt;/a&gt;.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;For the benefit of others on the community, please mark your post as the Accepted Solution.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Regards.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;--Sharon&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 19:10:17 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/org-json-simple-parser-ParseException-while-importing-custom/m-p/623054#M38404</guid>
      <dc:creator>slangley</dc:creator>
      <dc:date>2019-08-20T19:10:17Z</dc:date>
    </item>
  </channel>
</rss>

