cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Custom Thingworx extension is failing to import. Giving error message of JAR file

MK_10528389
8-Gravel

Custom Thingworx extension is failing to import. Giving error message of JAR file

I have created Thingworx extension (Bar Code Generator) in eclipse. I have used external jar - https://mvnrepository.com/artifact/net.sf.barcode4j/barcode4j/2.1  I have added this jar in build path in eclipse. Also added this jar under the lib folder in eclipse. Then run the application as gradle build and created the build. After that while importing the extension in composer, extension is validating successfully but while importing, it is giving an error - Failed to install extension BarCodeGeneratorTwx:1.0.3 because org/krysalis/barcode4j/output/CanvasProvider. Can someone please help here, what exactly I am missing here or I am placing jar in wrong place. Thanks in advance. Attached screenshot of error. 

ACCEPTED SOLUTION

Accepted Solutions

Well, that didn't add much information.

You can:

-Temporarily switch on stacktracing in LoggingSubsystem>Configuration and retry

-Check for the file ThingworxStorage\logs\ErrorLog.log

-Post the structure of your extension zip and your metadata.xml

 

It could be a missing class, a class loading conflict, a problem with the JVM version, or the jar file not property referenced in the metadata. Maybe also class initialization problem, i.e. static code being run on class loading and the proper config missing.

View solution in original post

5 REPLIES 5

Could be anything, have you looked into the Application Log?

Hi @Rocko Attaching the snap of application logs post trying to import.

Well, that didn't add much information.

You can:

-Temporarily switch on stacktracing in LoggingSubsystem>Configuration and retry

-Check for the file ThingworxStorage\logs\ErrorLog.log

-Post the structure of your extension zip and your metadata.xml

 

It could be a missing class, a class loading conflict, a problem with the JVM version, or the jar file not property referenced in the metadata. Maybe also class initialization problem, i.e. static code being run on class loading and the proper config missing.

Constantine
17-Peridot
(To:Rocko)

That CanvasProvider class is part of the library. I bet what happens here is that @MK_10528389's extension code tries to instantiate a CanvasProvider object, as they do in Barcode4j's Hello World. The code compiles fine in Eclipse, but doesn't get bundled in the ZIP correctly. The lib is 10 years old, so the JVM version mismatch shouldn't be a concern.

 

@MK_10528389 Make sure that your Barcode4j JAR file is referenced in the metadata.xml, as Rocko suggests. Something like that:

 

<Entities>
    <ExtensionPackages>
        <ExtensionPackage>
            <JarResources>
                ...
                <FileResource file="barcode4j.jar" type="JAR"/>
                ...
            </JarResources>
        </ExtensionPackage>
    </ExtensionPackages>
</Entities>

 

/ Constantine

Thanks @Rocko  After adding the JAR file reference in metadata.xml, the issue gets resolved. Thanks for the suggestion. Attached the snap of metadata.xml file.

Announcements


Top Tags