0

I've tried every solution I came across on here relating to this topic, but I am still not able to find a solution.

When running my project in Eclipse (Spring Boot + Maven),everything runs smooth. I am able to see some JSON data from an API call. My goal is to deploy this project on CloudFoundry, but I constantly get ClassNotFound error (Java). Below is my POM file.

I've tried exporting as a Runnable JAR and running that jar via command line, but I also get the NoClassFound error.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.intel</groupId>
    <artifactId>EDM</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>EDM</name>
    <description>EDM Library</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web-services</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        
<!-- Mentor Dependencies -->
        
        <dependency>
            <groupId>com.mentor.datafusion.oi</groupId>
            <artifactId>com.mentor.datafusion.oi</artifactId>
            <version>1.0.0</version>
        </dependency>
        
        <dependency>
            <groupId>com.mentor.dms.ui</groupId>
            <artifactId>com.mentor.dms.ui</artifactId>
            <version>1.0.0</version>
        </dependency>        
       
        <dependency>
            <groupId>com.mentor.dms.xml.importexport</groupId>
            <artifactId>com.mentor.dms.xml.importexport</artifactId>
            <version>1.0.0</version>
        </dependency>
        
        <dependency>
            <groupId>dfo</groupId>
            <artifactId>dfo</artifactId>
            <version>1.0.0</version>
        </dependency>        

        <dependency>
            <groupId>dfutils</groupId>
            <artifactId>dfutils</artifactId>
            <version>1.0.0</version>
        </dependency>    

        <dependency>
            <groupId>com.mentor.datafusion.dfo.is3</groupId>
            <artifactId>com.mentor.datafusion.dfo.is3</artifactId>
            <version>1.0.0</version>
        </dependency>
                  

        <dependency>
            <groupId>com.mentor.is3.edm.login.api</groupId>
            <artifactId>com.mentor.is3.edm.login.api</artifactId>
            <version>1.0.0</version>
        </dependency>
        
        <dependency>
            <groupId>com.mentor.datafusion.dfo.is3.api</groupId>
            <artifactId>com.mentor.datafusion.dfo.is3.api</artifactId>
            <version>1.0.0</version>
        </dependency>        
        
        <dependency>
            <groupId>apache-logging-log4j</groupId>
            <artifactId>apache-logging-log4j</artifactId>
            <version>1.0.0</version>
        </dependency>  
        
           
    </dependencies>
    

    <build>
        <plugins>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>repackage</goal>
              </goals>
              <configuration>
                <classifier>spring-boot</classifier>
                <mainClass>com.intel.EDM.EdmApplication</mainClass>
              </configuration>
            </execution>
          </executions>
          </plugin>
        </plugins>
    </build>

</project>

  • 1
    I think you want [`maven-shade-plugin`](https://stackoverflow.com/a/23937311/2970947). Or maybe [`spring-boot-maven-plugin`](https://stackoverflow.com/a/16222971/2970947). Good luck! – Elliott Frisch Apr 27 '21 at 00:45
  • Thanks, I tried the maven-shade-plugin and afterwards, I still received the same error "java.lang.ClassNotFoundException: com.mentor.datafusion.dfo.is3.common.dynhandlers.AbstractIS3XDMLicenseHandler" – Jonathan Sanchez Apr 27 '21 at 00:59
  • 1
    you tried maven-assembly-plugin too? – Kaneda Apr 27 '21 at 01:59
  • Yes, but I get the following error once I try to run the jar file; No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct. – Jonathan Sanchez Apr 27 '21 at 03:08

0 Answers0