Unable to load class: ErrorCoded


I am trying diffblue community edition but I cannot generate tests. I have the error:
R005 - Unable to load class: 1
Class: org.springframework.core.ErrorCoded

It is a deprecated class from Spring that I don’t have access to. Am I missing something? What should I do?

Hi @Florine ,

Thank you for raising this - it could be that this class is being called transitively.
What Spring version are you using in your project?
This Spring class was removed in Spring 5, it is worth confirming that you have a consistent set of spring dependencies all at same version.
If it the versions match and the issue still occurs, can you please also upload any of the support log file (guide to find log file here), and/or the code you are running Cover on?

Kind regards,
Jane @ Diffblue

I think it may come from a mismatch in Spring version. My project uses Spring Core 5.3.8 and Spring Test 5.3.8, but it has a dependency to a project I cannot change which imports Spring Web 4.3.18 and Spring Boot 1.5.9 and Diffblue tells me there is a mismatch between those versions. However I don’t get why it is looking for a Spring 4 dependency. Could this be the origin of the issue?

Hi @Florine

Yes, this is likely the issue
Cover only loads what the byte code is loading, so it is likely on that part of the code it is calling a dependency which is loading this deprecated class. The only way to get Cover to run on this class would be to change the build settings, however this could be arduous, it may be easiest to write a manual test case for this method.
The best action will depend on whether this issue is happening across all classes, in that case it may be worth spending time to adjust the build and get automated tests. Alternatively, if it isn’t very prevalent it may be better to write manual test cases.
For reference, the warn of the mis-matched Spring dependencies will come from that being present in the classpath. This won’t cause problems when test writing if not related to that dependency you mention.
I hope that helps - let me know if you have any further questions on this

Kind regards,
Jane @ Diffblue

Thank you for your answer! I have this problem on most tests I try to generate. What are the changes needed to be done in the build settings?



You would make a change to your build file to declare an exclusion for that dependency.
Here are the relative guides for each build system;
Keep in mind to check the possible side effects of this change on your project; in the respective documentation links above they give you an idea of what these effects might be.

Here’s an example for what this might look like in a Maven project:


Assuming your project will allow this exclusion; this should then allow you to get tests with Cover. If you try this, please let me know how this goes.

Kind regards,

Jane @ Diffblue