We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Word not working with SpringBoot - ClassCastException

I am using Aspose WORD to generate a Document for a Microsoft Word template. It is working fine when I invoke it using main() method in java. I can even run it from Junit using @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT).
But when I invoke this from within my Springboot application, the same code gives a ClassCastException -
java.lang.ClassCastException: com.poc.pojo.confdoc.ConfDocRoot cannot be cast to com.poc.pojo.confdoc.ConfDocRoot
at com.aspose.words.internal._be59985d54ff46c2baa5a00b05be25b2.getValue(Unknown Source)
at com.aspose.words.internal.zzL6.getValue(Unknown Source)
at com.aspose.words.internal.zzX.zzZ(Unknown Source)
at com.aspose.words.internal.zzL9.evaluate(Unknown Source)
at com.aspose.words.internal.zzUH.zzZ(Unknown Source)
at com.aspose.words.internal.zzDW.zzY(Unknown Source)
at com.aspose.words.internal.zzVM.zzZ(Unknown Source)
at com.aspose.words.internal.zzAZ.zzZ(Unknown Source)
at com.aspose.words.internal.zzCR.zzZ(Unknown Source)
Has anyone encountered this?

I have found the cause. It is not a problem with Aspose, but due to SpringBoot devtools.

For the time being I have removed SpringBoot dev tools dependencies to move forward until i get the appropriate solution.
Leaving the post here just in case someone else encounters this.


It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.