Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
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.
Solved! Go to Solution.
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.
Could be anything, have you looked into the Application Log?
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.
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.