10 Replies Latest reply on Jun 29, 2017 9:53 PM by bmessenger RSS
    knordstrom Newbie

    Can't import a ThingShape in an extension

    I'm trying to load up some objects through an extension I'm writing and I keep running into blocks when I import things. I have right now a ThingTemplate

     

    @ThingworxBaseTemplateDefinition(name = "GenericThing")

    @ThingworxPropertyDefinitions(properties = {

      @ThingworxPropertyDefinition(name = "Name", description = "Name of thing on Timeli's platform (required). Should be unique.", category = "", baseType = "STRING", isLocalOnly = false, aspects = {

      "isPersistent:true", "dataChangeType:VALUE" }), @ThingworxPropertyDefinition(name = "Samples", description = "", category = "", baseType = "THINGNAME", isLocalOnly = false, aspects = {

      "thingShape:Samples", "dataChangeType:VALUE" }) })

    public class MyThingTemplate extends Thing { ...

     

    and two ThingShape objects, Samples

     

    @ThingworxPropertyDefinitions(properties = {

      @ThingworxPropertyDefinition(name = "Samples", description = "", category = "", baseType = "INFOTABLE", isLocalOnly = false, aspects = {

      "dataChangeType:VALUE", "isEntityDataShape:true", "dataShape:Sample" }) })

    public class Samples extends ThingShape {

     

    and Sample (singular)

     

    @ThingworxPropertyDefinitions(properties = {

      @ThingworxPropertyDefinition(name = "Timestamp", description = "", category = "", baseType = "DATETIME", isLocalOnly = false, aspects = {

      "dataChangeType:VALUE" }), @ThingworxPropertyDefinition(name = "Value", description = "", category = "", baseType = "NUMBER", isLocalOnly = false, aspects = {

      "dataChangeType:VALUE" }) })

    public class Sample extends ThingShape {

     

    All objects are stubs in the sense there's as yet no Java code in them.

     

    My metadata.xml:

     

    <?xml version="1.0" encoding="UTF-8" standalone="no"?><Entities>

        <ExtensionPackages>

            <ExtensionPackage dependsOn="" description="" minimumThingWorxVersion="7.2.1" name="penrose" packageVersion="0.0.0004" vendor="">

                <JarResources>

                    <FileResource description="" file="penrose.jar" type="JAR"/>

                </JarResources>

            </ExtensionPackage>

        </ExtensionPackages>

        <ThingPackages>

            <ThingPackage className="io.timeli.penrose.MyThingTemplate" description="" name="MyThingTemplatePackage"/>

        </ThingPackages>

        <ThingTemplates>

            <ThingTemplate aspect.isEditableExtensionObject="false" description="" name="MyThingTemplate" thingPackage="MyThingTemplatePackage"/>

        </ThingTemplates>

        <ThingShapes>

            <ThingShape aspect.isEditableExtensionObject="false" className="io.timeli.penrose.Samples" description="" name="Samples"/>

            <ThingShape aspect.isEditableExtensionObject="false" className="io.timeli.penrose.Sample" description="" name="Sample"/>

        </ThingShapes>

    </Entities>

     

    It builds on my local, of course, because there's no code to compile. But when I import, I get the following:

     

    Import Failed: Validation Failure: ThingShape Samples Had An Invalid Class Name : [io.timeli.penrose.Samples] - Possibly Missing Extension Package

     

    What am I missing? Please feel free to ask for more information. But it seems to me I've declared the fully qualified classname for Samples in the metadata.xml and the class file is present in the jar. The objects all extend the appropriate base classes. So what else is there to do?

      • Re: Can't import a ThingShape in an extension
        ttielebein Collaborator

        The only thing I can think of for this is, are you sure these classes are properly located in this package (io.timeli.penrose)? Perhaps there is an issue with the property and thingShape having the same name? I don't see why that would be a problem... are you still having issues with this?

          • Re: Can't import a ThingShape in an extension
            knordstrom Newbie

            Thanks for the response.

             

            I'm sure of these things. What I have right now is pretty close to the most basic possible project, so I'm pretty confused.

             

            I've set up using Eclipse (Neon) and the TW plugin. I even created another project entirely in case there was some artifact of my messing around earlier causing issues. All entities were created using the plugin, the only thing I changed was adding the "extends ThingShape" to the Samples object in case the error message was mischaracterized somehow and it was really just having difficulty implementing a ThingShape with the class.

             

            Here's a screenshot of the project as it stands:Screenshot 2016-11-03 18.19.01.png

            And here's a screenshot of trying to upload patterns.zip from my distributions directory:

            Screenshot 2016-11-03 18.31.09.png

            If it helps anyone (for perusing logs), the IP of the AWS instance this was attempted on is 52.5.227.117.

          • Re: Can't import a ThingShape in an extension
            Sajid Patel Apprentice

            I faced the same issue, I do not have proper solution, but I noticed that the 'className' attribute for ThingShape in metadata.xml is not acceptable for some reason. If I remove it then the extension installs fine. However I am not sure if this is a proper fix, I do not have anything meaningful in my class to be able to check.

            • Re: Can't import a ThingShape in an extension
              rpallares Explorer

              I have the same probelm.

              Did you find any solution?

              • Re: Can't import a ThingShape in an extension
                polinao Collaborator

                Tori Tielebein have you investigated this any further and/or created a ticket on customer's behalf? If not, please do, especially now with multiple people reporting.

                 

                Rafael PALLARES Sajid Patel Keith Nordstrom what are the thingworx and sdk version you are using? Please note this article too, https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS214774&lang=en_US  although at least from the first screenshot in this thread it's obvious the version is 7.x.

                  • Re: Can't import a ThingShape in an extension
                    ttielebein Collaborator

                    I cannot reproduce this using the 7.2 SDK and importing into 7.3. My ThingShape and ThingTemplate both import fine, even though they are in a package and everything. I am really not sure what the issue is here.

                    • Re: Can't import a ThingShape in an extension
                      rpallares Explorer

                      Hello,

                       

                      I'm using ThingWorx 7.1.3 and the SDK version is 7.1.0.

                      I just created the ThingShape using the eclipse plugin as I create other entities.

                       

                      The node created into metadata.xml is very simple:

                      <ThingShapes>

                          <ThingShape aspect.isEditableExtensionObject="false" className="a.java.package.QueryBuilderSParam" description="" name="QueryBuilderSParam"/>

                      </ThingShapes>

                        • Re: Can't import a ThingShape in an extension
                          bmessenger Newbie

                          Hi all,

                          I also have the same problem. This is with Thingworx 8.0 and Extension SDK 8.0, Thingworx extension builder lpgin for Eclipse 7.2 and Eclipse Mars 4.5.2. It is my understanding that these are the latest stable versions for all software.

                           

                          I can verify that if you remove the className node in the ThingShape definition in the metadata.xml file then the extension will import but all my services in the custom ThingShape are not available.

                          I have similar issues with creating a resource library (it won't import), a script library (it won't create and services).

                           

                          So we need a fix for this, otherwise all I can create through the extension plugin is a custom thing template, which is rather limiting.

                           

                          Regards

                          Ben

                            • Re: Can't import a ThingShape in an extension
                              bmessenger Newbie

                              I have done more experimentation with this and I have found a few issues that can be resolved. I can now actually get my ThingShape extension to import and the service(s) to show in the thing shape.

                               

                              My metadata.xml I think is essentially unchanged to what is created by the Thingworx Eclipse extension, but I'll post it here in case there is some subtle difference.

                               

                              <?xml version="1.0" encoding="UTF-8" standalone="no"?>

                              <Entities>

                                  <ExtensionPackages>

                                      <ExtensionPackage dependsOn="" description="" minimumThingWorxVersion="8.0.0" name="RegainCustomTWX" packageVersion="1.1.13" vendor="Regain">

                                             <JarResources>

                                              <FileResource description="" file="regaincustomtwx.jar" type="JAR"/>

                                          </JarResources>

                                      </ExtensionPackage>

                                  </ExtensionPackages>

                              <ThingShapes>

                                      <ThingShape  aspect.isEditableExtensionObject="false" description="A generic thing shape to hold many custom functions" className="com.regain.thingworx.RegainGenShape" name="RegainGenShape">

                                      </ThingShape>

                                  </ThingShapes>

                              </Entities>

                               

                              But what I also did was the following to get it to import

                               

                              1. Go to the Thingworx server, and in the the ThingWorx storage area under extensions (in my case C:\ThingworxStorage\extensions), delete the extension name in question. (In my case RegainCustomTWX). This I think stops Thingworx from using an earlier version or caching. It may not even exist if you have never been able to import it before.

                              2. Recycle your tomcat. This seems to be the critical part. Why i is required when you have never imported I do not know but I could not get it to work unless I did this.

                              3. Clear your browser cache. I even restarted my client browser after clearing, but it did not ask me to relogin, so another Chrome session must have been holding the login details in a cookie

                               

                              I don't know if you require all these steps. I think step 2 is the most critical but I cannot tell you why. But this is the only way I have had a successful import.

                               

                              Hope this works for others. It may not, because it really has been stab in the dark to get any consistency.

                               

                              Regards

                              Ben