has an error using Aspose CAD libraries with Spring Boot Maven project as below :
a. Proudct : Aspose Total for Java(v3.0)
b. Error issue
After Spring Boot Maven packaging ( .jar ), error occurs when loading dxf file by
Image.load() from the codes created “CadImage image = (CadImage) Image.load(sourcePath)” ;
However, it works well in local IDE before the packaging.
c. Version with error : from 21.3 version or newer ; 20.9 version has no this problem.
d. Test OS : Windows 10, Ubuntu 22.04
e. Java being used : OpenJDK 18.0.2
Please check and advise why the problem occurs and how it can be solved.
Your prompt attention to the matter will be appreciated.
f. Error Code:
com.aspose.cad.cadexceptions.ImageLoadException: Image loading failed: Cannot invoke “com.aspose.cad.system.collections.Generic.Dictionary.tryGetValue(Object, Object[])” because the return value of “com.aspose.cad.fileformats.cad.cadobjects.CadBase.h()” is null
at com.aspose.cad.Image.a(Unknown Source)
at com.aspose.cad.Image.load(Unknown Source)
…
Caused by: com.aspose.cad.cadexceptions.ImageLoadException: Cannot invoke “com.aspose.cad.system.collections.Generic.Dictionary.tryGetValue(Object, Object[])” because the return value of “com.aspose.cad.fileformats.cad.cadobjects.CadBase.h()” is null
at com.aspose.cad.internal.km.k.a(Unknown Source)
… 15 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke “com.aspose.cad.system.collections.Generic.Dictionary.tryGetValue(Object, Object[])” because the return value of “com.aspose.cad.fileformats.cad.cadobjects.CadBase.h()” is null
at com.aspose.cad.fileformats.cad.cadobjects.CadBase.a(Unknown Source)
at com.aspose.cad.internal.gO.a.a(Unknown Source)
at com.aspose.cad.internal.gO.f.b(Unknown Source)
at com.aspose.cad.internal.gO.f.a(Unknown Source)
at com.aspose.cad.fileformats.cad.cadtables.CadVportTableObject.a(Unknown Source)
at com.aspose.cad.internal.gi.g.a(Unknown Source)
at com.aspose.cad.internal.gi.g.a(Unknown Source)
at com.aspose.cad.internal.gi.c.i(Unknown Source)
at com.aspose.cad.internal.gi.c.C(Unknown Source)
at com.aspose.cad.internal.gi.c.s(Unknown Source)
… 16 common frames omitted
@hs.jo,
please, make sure that when using Aspose.CAD for Java (>21.1) you don’t move the API to another package, the API must remain in com.aspose.cad.
@hs.jo,
I’m sorry for misunderstanding. Could you please help us further and create empty project with this file and settings you mentioned, so we can run it and see the issue? Thanks.
@hs.jo,
Hello. We tested this case and found that Spring Boot Maven re-assembles library so namespaces are changed which is not allowed use case for our product. Probably, you can use something like this JarClassLoader for your case.