Failed to create Spring context E019

Hi. I just discovered and downloaded Diff Blue today and tried to have it create a test, but got an E019 error, with the following additional info from the log:

17:43:39.998 [INFO][analyzer-service:grpc-default-executor-1][c.d.c.a.a.f] Analysis of com.gm.gsmc.gpms.profile.manager.KafkaManager.kafkaUpdateProfileEvent:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/time/LocalDateTime;)V has thrown an exception:
Code: E019
Message: Failed to create Spring context
Details:
Hint: Please contact Diffblue support.
Affected: []
Cause: java.lang.IllegalStateException: Failed to load ApplicationContext

17:43:40.507 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] Encountered an internal error E009: Unrecoverable runtime error
17:43:40.507 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] Details: Exception: java.lang.AssertionError: Can’t handle interfaces in regular object handler

I’m on Win10 Pro
Java 8.0_261
It’s a Spring Boot (2.1.12.RELEASE) app

Thanks,
Seth

P.S. How do I send the cover-plugin.log file?

1 Like

Hi Seth,

Thank you for your message. I am sorry that you experienced this error.
We are looking into it and have now identified the source of the issue.

The log file would nevertheless be useful to us.
Would you be able to send it via the upload button in this forum?

If your project were accessible to us (e.g. open-source) it would allow us to double-check our fix against it.

Many thanks,
Joel Allred
Software Engineering Manager, Diffblue

Same issue here. I’d like to upload my logs, but it says “new users cannot upload attachments”

Hi Simon,
You should be able to upload files now
Regards
Andy

coverpluginlog.zip (6.8 KB)

Hey Joel. Thanks for the reply. I’ve uploaded the log file but our project is not open source and I can’t share it, sorry.

Thanks,
Seth

Hi, similarly can’t share our project code, because it’s closed source, but here’s the logs now
Archive.zip (37.7 KB)

Hi Seth,

Many thanks for the log files.
We have now created a fix for the E009 which we hope will resolve the E019.
It will be available in the upcoming plugin release 2021.06.01 which will be published to the IntelliJ MarketPlace early next week.

If you could try again with the new release, we could check that there is no other problem on your side.

Let me know if I can be of any help in the meantime.

Thanks

Joel

Hi @Simon_Democko,

Many thanks for sending your logs over.
The JetBrains JDK you are using does not seem to allow Mockito to attach an agent.

Are you able to try again with a different JDK (e.g. Oracle or OpenJDK)?

Can you perhaps also tell which version of Mockito and/or spring-boot-starter-test you are using?

Many thanks
Joel

Spring boot starter 2.4.5
I did not find Mockito in the pom.xml, but I ran mvn dependency:analyze and found
used undeclared dependencies with versions:
[WARNING] org.mockito:mockito-core:jar:3.6.28:test
[WARNING] org.mockito:mockito-junit-jupiter:jar:3.6.28:test

I quickly checked docs, but seems like beyond junit, Diffblue is not requiring anything else: Maven dependencies | Diffblue Docs but even so, it seems like Mockito is pulled in somehow anyway.

I switched to Java 11.0.11.hs-adpt that’s AdoptOpenJDK and I got the same error.

Could it just be that what happens is the same issue as Seth’s?

I temporarily tried also now to add these dependencies (docs.diffblue .com)/knowledge-base/JCover/mocking/ and ran it again with AdoptOpenJDK and same error occurred. (there’s powermock and mockito in that link) Here’s the latest logs:
Archive.zip (67.9 KB)

sorry, had to break apart the second link, your forum does not allow me to post more than 2 links, cause I’m a new user… :lol:

Hi Simon

Thank you!

Mockito is usually pulled in by spring-boot-starter-test cf. https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test/2.4.5

It is indeed possible to run our product without Mockito, but that would result in much lower coverage, especially on Spring projects.

I believe the source of the E019 is different than in Seth’s case. I had a look at your logs but it seems that DCover is still running with the JetBrains JDK:

Server command-line: /Applications/IntelliJ IDEA.app/Contents/jbr/Contents/Home/bin/java

Do you have the log file for the run with the AdoptOpenJDK version?
The JDK change might need a rebuild of the project to take effect.

Joel

Archive.zip (79.1 KB)
Hi, I checked again that I’m using AdoptOpenJDK, rebuilt the project, restarted IDEa, check java --version again, ran diffblue, same error.

I took a quick look in the log (included in the archive) and this time, 18:06 I see AdoptOpenJDK being used, see

18:06:27.816 [INFO][analyzer-service:TimedExecutor-11][c.d.cover.c.b] > org.mockito.exceptions.base.MockitoInitializationException:
Could not initialize inline Byte Buddy mock maker.

It appears as if your JDK does not supply a working agent attachment mechanism.
Java : 11
JVM vendor name : AdoptOpenJDK
JVM vendor version : 11.0.8+10
JVM name : OpenJDK 64-Bit Server VM
JVM version : 11.0.8+10
JVM info : mixed mode
OS name : Mac OS X
OS version : 10.16

Simon,

It looks like the latest attached Archive.zip file does not correspond to your description. The timestamps are rather around 14:30 and the mentioned JDK is still the JetBrains one.

Can you perhaps double-check?

Thank you
Joel

Hi, I downloaded and checked and both executions are there. Just scroll to the bottom, the 18:06 executions are at the bottom. I did not delete the log files before doing the latter executions, so it appended it.

Hi @Simon_Democko

Indeed. Sorry I missed that the first time around.

In order to figure out where the error comes from, would it be possible for you to try generating some tests for Spring PetClinic (GitHub - spring-projects/spring-petclinic: A sample Spring-based application), say for the OwnerController class?

This could help us figure out whether the issue is related to your environment or to the specifics of your project.

Thanks
Joel

Hi @sethbott

The latest version of the plugin (2021.06.01) has now been published to the JetBrains Marketplace.
Are you able to update the plugin and check whether your issue has now been fixed?

Thank you
Joel

Hi,

For petclinic I ran it twice in a row. First time it didn’t generate anything. Second time it generated quite a bunch of tests. Not sure why first time it didn’t do it.

Logs attached.
Archive.zip (3.9 KB)