Rate This Document
Findability
Accuracy
Completeness
Readability

UT Case Generation Failure

Symptom

A UT case fails to be generated and an error is reported stating "failed to generate UT because the error: java.lang.ClassNotFoundException."

Log path: C:\Users\username\AppData\Local\Temp\UTgen\rdEngineProcessLogs\utgen-engine-current.log

username: local user name.

14:41:59.881 | ERROR | Api                       | The class com.ruoyi.framework.config.ShiroConfig failed to generate UT because the error: java.lang.ClassNotFoundException: org.thymeleaf.dialect.AbstractProcessorDialect
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
	at org.utbot.common.FallbackClassLoader.loadClass(FallbackClassLoader.kt:41)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)

Possible Causes

The JAR package dependencies are missing in the project or module, and some classes fail to be loaded.

Troubleshooting Procedure

Add JAR dependencies to the pom.xml or build.gradle file.

For example, add JAR dependencies to the pom.xml file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf</artifactId>
    <version>3.0.15.RELEASE</version>
    <exclusions>
        <exclusion>
            <groupId>ognl</groupId>
            <artifactId>ognl</artifactId>
        </exclusion>
    </exclusions>
</dependency>