Can't find common super class of

Hello, I use Proguard maven plugin 2.5.1 to obfuscate Spring MVC application, however even after adding all the libraries it still says, there is something missing but there is certainly not.

How should I understand the error, what of the specified below is missing ? Is it ThymeleafReactiveViewResolver or reactor/core/publisher/Mono; or org.springframework.beans.factory.config.BeanDefinition ?

 [proguard] Warning: there were 11354 unresolved references to classes or interfaces.
 [proguard]          You may need to add missing library jars or update their versions.
 [proguard]          If your code works fine without the missing classes, you can suppress
 [proguard]          the warnings with '-dontwarn' options.
 [proguard]          (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass)
 [proguard] Warning: there were 68 instances of library classes depending on program classes.
 [proguard]          You must avoid such dependencies, since the program classes will
 [proguard]          be processed, while the library classes will remain unchanged.
 [proguard]          (https://www.guardsquare.com/proguard/manual/troubleshooting#dependency)
 [proguard] Warning: there were 68 unresolved references to program class members.
 [proguard]          Your input classes appear to be inconsistent.
 [proguard]          You may need to recompile the code.
 [proguard]          (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedprogramclassmember)
 [proguard] Warning: there were 7 unresolved references to library class members.
 [proguard]          You probably need to update the library versions.
 [proguard]          (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedlibraryclassmember)
 [proguard] Error: 
 [proguard] 
 [proguard] It appears you are missing some classes resulting in an incomplete class hierarchy, 
 [proguard] please refer to the troubleshooting page in the manual: 
 [proguard] https://www.guardsquare.com/en/products/proguard/manual/troubleshooting#superclass
 [proguard] 
 [proguard] Unexpected error while performing partial evaluation:  Class       = [org/thymeleaf/spring5/view/reactive/ThymeleafReactiveViewResolver]  Method      = [loadView(Ljava/lang/String;Ljava/util/Locale;)Lreactor/core/publisher/Mono;]  Exception   = [proguard.evaluation.IncompleteClassHierarchyException] (Can't find common super class of [org.thymeleaf.spring5.view.reactive.ThymeleafReactiveView] (with 1 known super classes: org.thymeleaf.spring5.view.reactive.ThymeleafReactiveView) and [org.springframework.beans.factory.config.BeanDefinition] (with 2 known super classes: org.springframework.beans.factory.config.BeanDefinition, java.lang.Object))Unexpected error while preverifying:  Class       = [org/thymeleaf/spring5/view/reactive/ThymeleafReactiveViewResolver]  Method      = [loadView(Ljava/lang/String;Ljava/util/Locale;)Lreactor/core/publisher/Mono;]  Exception   = [proguard.evaluation.IncompleteClassHierarchyException] (Can't find common super class of [org.thymeleaf.spring5.view.reactive.ThymeleafReactiveView] (with 1 known super classes: org.thymeleaf.spring5.view.reactive.ThymeleafReactiveView) and [org.springframework.beans.factory.config.BeanDefinition] (with 2 known super classes: org.springframework.beans.factory.config.BeanDefinition, java.lang.Object))

my pom.xml build section:

    <build>
        <plugins>
 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            
       
            <plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <obfuscate>true</obfuscate>
                    <injar>${project.build.finalName}.war</injar>
                    <outjar>${project.build.finalName}-small.war</outjar>
                    <outputDirectory>${project.build.directory}</outputDirectory>
                    <!--proguardInclude>${basedir}/proguard.conf</proguardInclude-->
                    <!--outFilter>**/WEB-INF/classes/**.class</outFilter-->
                    <injarNotExistsSkip>true</injarNotExistsSkip>
                    <options>
                        <option>-allowaccessmodification</option>
                        <option>-dontoptimize</option>
                        <option>-dontskipnonpubliclibraryclasses</option>
                        <option>-keepnames interface **</option>
                        <option>-keepparameternames</option>
                        <option>-adaptclassstrings</option>
                        <option>-keepdirectories</option>
                        <option>-dontshrink</option>
                        <option>-dontnote</option>
                        <option>-ignorewarnings</option>
                        <option>-keepattributes
                            Exceptions,
                            InnerClasses,
                            Signature,
                            Deprecated,
                            SourceFile,
                            LineNumberTable,
                            *Annotation*,
                            EnclosingMethod
                        </option>

                        <option>-keep interface * extends * { *; }</option>
                        <option>-keep class com.slm.proguard.example.spring.boot.config.BeanConfig</option>
                        <option>-keep class org.json.JSONObject.** {** put(java.lang.String,java.util.Map);}</option>
                        <option>-keep class module-info</option>
                        <option>-keepattributes Module*</option>
                        <option>-keep @org.springframework.transaction.annotation.Transactional class *</option>
                        <option>-keep @org.springframework.stereotype.Service class *</option>
                        <option>-keep @org.springframework.stereotype.Controller class *</option>
                        <option>-keep @org.springframework.beans.factory.annotation.Autowired class *</option>
                        <!--option>-keepclassmembers class * {
                            @org.springframework.beans.factory.annotation.Autowired&lt;fields&gt;;
                            @org.springframework.beans.factory.annotation.Autowired&lt;methods&gt;;
                            }
                        </option-->
                        <option>-keep @org.springframework.web.bind.annotation.ResponseBody class *</option>
                        <option>-keep @org.springframework.web.bind.annotation.RequestMapping class *</option>
                        <option>-keep @org.springframework.stereotype.Repository class *</option>
                        <option>-keep @javax.annotation.Resource class *</option>
                        <option>-keep @javax.persistence.Entity class *</option>
                        
                        
                        
                       
                        <option>-keeppackagenames javax.*</option>
                        <option>-keeppackagenames org.*</option>
                        <option>-keeppackagenames com.*</option>
                        <option>-keeppackagenames io.*</option>
                        <option>-keeppackagenames ch.*</option>
                        <option>-keeppackagenames java.*</option>
                        
                        <option>-keep class javax.** { *; }</option>
                        <option>-keep class org.** { *; }</option>
                        <option>-keep class com.** { *; }</option>
                        <option>-keep class ch.** { *; }</option>
                        <option>-keep class io.** { *; }</option>
                        <option>-keep class java.** { *; }</option>
                        <option>-keep interface javax.** { *; }</option>
                        <option>-keep interface org.** { *; }</option>
                        <option>-keep interface com.** { *; }</option>
                        <option>-keep interface ch.** { *; }</option>
                        <option>-keep interface io.** { *; }</option>
                        <option>-keep interface java.** { *; }</option>
                        <option>-keep enum javax.** { *; }</option>
                        <option>-keep enum org.** { *; }</option>
                        <option>-keep enum com.** { *; }</option>
                        <option>-keep enum ch.** { *; }</option>
                        <option>-keep enum io.** { *; }</option>
                        <option>-keep enum java.** { *; }</option>
  
                    </options>
                    <libs>
                        <lib>C:\Program Files\Java\jdk1.8.0_241\jre\lib\rt.jar</lib>
                        
                        
                        
                        <lib>${basedir}/lib/activation-1.1.1.jar</lib>
                        <lib>${basedir}/lib/antlr-2.7.7.jar</lib>
                        <lib>${basedir}/lib/attoparser-2.0.4.RELEASE.jar</lib>
                        <lib>${basedir}/lib/byte-buddy-1.10.2.jar</lib>
                        <lib>${basedir}/lib/classgraph-4.8.83.jar</lib>
                        <lib>${basedir}/lib/classmate-1.5.1.jar</lib>
                        <lib>${basedir}/lib/Cloudmersive.APIClient.Java-v2.75.jar</lib>
                        <lib>${basedir}/lib/commons-dbcp2-2.7.0.jar</lib>
                        <lib>${basedir}/lib/commons-fileupload-1.4.jar</lib>
                        <lib>${basedir}/lib/commons-io-2.7.jar</lib>
                        <lib>${basedir}/lib/commons-lang3-3.11.jar</lib>
                        <lib>${basedir}/lib/commons-logging-1.2.jar</lib>
                        <lib>${basedir}/lib/commons-pool2-2.7.0.jar</lib>
                        <lib>${basedir}/lib/dom4j-2.1.1.jar</lib>
                        <lib>${basedir}/lib/FastInfoset-1.2.15.jar</lib>
                        <lib>${basedir}/lib/gson-2.8.6.jar</lib>
                        <lib>${basedir}/lib/gson-fire-1.8.0.jar</lib>
                        <lib>${basedir}/lib/hibernate-commons-annotations-5.1.0.Final.jar</lib>
                        <lib>${basedir}/lib/hibernate-core-5.4.9.Final.jar</lib>
                        <lib>${basedir}/lib/istack-commons-runtime-3.0.7.jar</lib>
                        <lib>${basedir}/lib/jackson-annotations-2.9.10.jar</lib>
                        <lib>${basedir}/lib/jackson-core-2.9.10.jar</lib>
                        <lib>${basedir}/lib/jackson-databind-2.9.10.jar</lib>
                        <lib>${basedir}/lib/jackson-dataformat-yaml-2.9.10.jar</lib>
                        <lib>${basedir}/lib/jandex-2.1.1.Final.jar</lib>
                        <lib>${basedir}/lib/javaee-endorsed-api-7.0.jar</lib>
                        <lib>${basedir}/lib/javaee-web-api-8.0.1.jar</lib>
                        <lib>${basedir}/lib/javassist-3.24.0-GA.jar</lib>
                        <lib>${basedir}/lib/javax.activation-api-1.2.0.jar</lib>
                        <lib>${basedir}/lib/javax.mail-1.6.2.jar</lib>
                        <lib>${basedir}/lib/javax.mail-api-1.6.2.jar</lib>
                        <lib>${basedir}/lib/javax.persistence-api-2.2.jar</lib>
                        <lib>${basedir}/lib/jaxb-api-2.3.1.jar</lib>
                        <lib>${basedir}/lib/jaxb-runtime-2.3.1.jar</lib>
                        <lib>${basedir}/lib/jboss-logging-3.3.2.Final.jar</lib>
                        <lib>${basedir}/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar</lib>
                        <lib>${basedir}/lib/jsoup-1.13.1.jar</lib>
                        <lib>${basedir}/lib/logging-interceptor-2.7.5.jar</lib>
                        <lib>${basedir}/lib/mapstruct-1.3.1.Final.jar</lib>
                        <lib>${basedir}/lib/mysql-connector-java-8.0.18.jar</lib>
                        <lib>${basedir}/lib/NeonCloudData-1.0-SNAPSHOT.jar</lib>
                        <lib>${basedir}/lib/ognl-3.1.12.jar</lib>
                        <lib>${basedir}/lib/okhttp-2.7.5.jar</lib>
                        <lib>${basedir}/lib/okio-1.6.0.jar</lib>
                        <lib>${basedir}/lib/protobuf-java-3.6.1.jar</lib>
                        <lib>${basedir}/lib/slf4j-api-1.7.25.jar</lib>
                        <lib>${basedir}/lib/snakeyaml-1.23.jar</lib>
                        <lib>${basedir}/lib/spring-aop-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-beans-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-context-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-core-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-expression-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-jcl-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-jdbc-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-orm-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-plugin-core-2.0.0.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-plugin-metadata-2.0.0.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-security-config-5.3.8.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-security-core-5.3.8.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-security-web-5.3.8.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-tx-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-web-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/spring-webmvc-5.2.12.RELEASE.jar</lib>
                        <lib>${basedir}/lib/springfox-core-3.0.0.jar</lib>
                        <lib>${basedir}/lib/springfox-schema-3.0.0.jar</lib>
                        <lib>${basedir}/lib/springfox-spi-3.0.0.jar</lib>
                        <lib>${basedir}/lib/springfox-spring-web-3.0.0.jar</lib>
                        <lib>${basedir}/lib/springfox-spring-webflux-3.0.0.jar</lib>
                        <lib>${basedir}/lib/springfox-spring-webmvc-3.0.0.jar</lib>
                        <lib>${basedir}/lib/springfox-swagger-common-3.0.0.jar</lib>
                        <lib>${basedir}/lib/springfox-swagger-ui-2.9.2.jar</lib>
                        <lib>${basedir}/lib/springfox-swagger2-3.0.0.jar</lib>
                        <lib>${basedir}/lib/stax-ex-1.8.jar</lib>
                        <lib>${basedir}/lib/swagger-annotations-1.5.15.jar</lib>
                        <lib>${basedir}/lib/swagger-annotations-2.1.2.jar</lib>
                        <lib>${basedir}/lib/swagger-models-1.5.20.jar</lib>
                        <lib>${basedir}/lib/threetenbp-1.3.5.jar</lib>
                        <lib>${basedir}/lib/thymeleaf-3.0.9.RELEASE.jar</lib>
                        <lib>${basedir}/lib/thymeleaf-extras-springsecurity5-3.0.4.RELEASE.jar</lib>
                        <lib>${basedir}/lib/thymeleaf-spring5-3.0.11.RELEASE.jar</lib>
                        <lib>${basedir}/lib/txw2-2.3.1.jar</lib>
                        <lib>${basedir}/lib/unbescape-1.1.5.RELEASE.jar</lib>
                        <lib>${basedir}/lib/vatchecker-1.4.3.jar</lib>
                        <lib>${basedir}/compilelib/reactive-streams-1.0.3.jar</lib>
                        <lib>${basedir}/compilelib/reactor-core-3.4.11.jar</lib>

                    </libs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <!-- attached to Maven test phase -->
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Thank you for any help.

Hi @Dakado ,

The missing classes seem to come from the spring framework. You will need to use the -injars option or -libraryjars option to make sure the spring jars are part of the input provided to ProGuard. This issue is documented in our troubleshooting section under “Warning: can’t find superclass or interface Warning: can’t find referenced class”, here: ProGuard Manual: Troubleshooting | Guardsquare

Please let me know if anything is not clear.

Kind regards,

Jonas

How do we point to the jars? I have a similar issue and the jars are just download by Maven and packaged in the jar that is created. And what if we don’t want to obfuscate the Spring stuff? We only want to obfuscate our stuff

Hi @Peter_Kronenberg ,

The file path will work, in case these jars are coming from Maven, you can download these from e.g. the Maven Central repository: https://mvnrepository.com/repos/central.

Kind regards,

Jonas

I don’t quite follow. Are you saying that I have to manually download all the dependencies that Maven would normally download, so that I can point ProGuard to them? They are all in the jar. How can I just point to the dependencies in the jar? I want Proguard to include files in the classes directory (which is my app) but not include the jars that are in the lib directory, which are all the dependencies. This is a standard SpringBoot jar.