Maven प्रोजेक्ट में ClassNotFoundException समस्या

Aug 29 2020

मुझे नौकरी के लिए अपने आवेदन के हिस्से के रूप में एक परियोजना को पूरा करने के लिए सौंपा गया था। कंपनी मुझे निम्नलिखित आवश्यकताओं को स्थापित करने के लिए भेजती है:

  • OpenJDK 1.8
  • मावेन 3.x
  • गिट 2.x
  • MySQL 5.x.

मैं सर्वर साइड (जावा) से ऐप को चलाने की कोशिश कर रहा हूं और यह इस अपवाद को फेंकता है (शायद एक निर्भरता मुद्दा है लेकिन मैं इसे नहीं ढूंढ सकता):

2020-08-30 07: 34: 56.850 ERROR org.springframework.boot.SpringApplication: 858 - एप्लिकेशन रन विफल हुआ java.lang.NoClassDefFoundError: org / springframework / boot / bind / RelaxedDataBinder org.springframework.bootwork/boot.com/boot/boot पर क्लिक करें। getExcludeAutoConfigurationsProperty org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.getExclusions पर (EnableAutoConfigurationImportSelector.java:179) (EnableAutoConfigurationImportSelector.java:172) org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.selectImports पर (EnableAutoConfigurationImportSelector.java:87) org.springframework पर .context.annotation.ConfigurationClassParser$DefaultDeferredImportSelectorGroup.process(ConfigurationClassParser.java:892) at org.springframework.context.annotation.ConfigurationClassParser$Org.springframework.context.annotation.ConfigurationClassParser पर DeferredImportSelectorGrouping.getImports (configurationClassParser.java:878)$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:804) at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process (configClassParser.java:774) org.springframework.context.annotation.ConfigurationClassPassser.parse (कॉन्फ़िगरेशनक्लासपासर.जवा.18.185) पर org.springframework/rample/ram/free/sr=sr=fr/free-run-run-rp-blog-rut-chant-run-l=cr==5 .springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors पर (ConfigurationClassPostProcessor.java:232) (PostProcessorRegistrationDelegate.java:275) org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors पर (PostProcessorRegistrationDelegate .java: 95) org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors (AbstractApplicationContext.java.705) org.springframework.context.support.AbstractApplicationContextxt पर। tApplicationContext.java and31) org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (। ServletWebServerApplicationContext.java:142) पर org.springframework। (.boot.SpringApplication.refreshContext (SpringApplication.java:397) org.springframework.boot.SpringApplication.run (SpringApplication .java:316) पर org.springframework.boot.SpringApplication.run (वसंत-वसंत) Springframework.boot.SpringApplication.run (SpringApplication.java:1248) पर gr.publicsoft.springbootcrud.Application.main (Application.java:12) java.base / jdk.internal.reflect.NativeMethodAccessorImpl.in पर करें। java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) java.base / jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodMethodethope) पर क्लिक करें। प्रतिबिंबित .ethod.invoke (Method.java and66) पर या g.springframework.boot.devtools.restart.RestartLauncher.run (RestartLauncher.java:49) इसके कारण: java.lang.ClassNotroundException: org.springframework.boot.bind.elaxedData.indind.ind.ind.ind.ind.ind.ind.ind.ind.ind.ind.ind.ind/Ab.bw पर क्लिक करें। java। java.lang.ClassNoteround.com। .loadClass (BuildinClassLoader.java )81 java.base / jdk.internal.loader.ClassLoaders $ AppClassLoader.loadClass (ClassLoaders.java.178) पर java.base / java.lang.ClassLoader.loadClass (क्लास क्लास) ) ... 26 आम फ्रेम छोड़ा गया

**Pom.xml(general in project)**
<?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 http://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.1.4.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>gr.publicsoft.springbootcrud</groupId>
<artifactId>spring-boot-crud</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>

<properties>
    <java.version>1.8</java.version>
</properties>

<modules>
    <module>springbootcrud-domain</module>
    <module>springbootcrud-service</module>
    <module>springbootcrud-webapp</module>
</modules>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

</project>

**Pom.xml(inside app folder)**
<?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 http://maven.apache.org/xsd/maven- 
4.0.0.xsd">
<parent>
    <artifactId>spring-boot-crud</artifactId>
    <groupId>gr.publicsoft.springbootcrud</groupId>
    <version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>springbootcrud-webapp</artifactId>



<properties>
    <java.version>1.8</java.version>
    <finalName>${project.artifactId}-${project.version}</finalName> </properties> <profiles> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> </profiles> <dependencies> <dependency> <groupId>gr.publicsoft.springbootcrud</groupId> <artifactId>springbootcrud-service</artifactId> <version>${project.parent.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
    </dependency>
    <dependency>
        <groupId>eu.bitwalker</groupId>
        <artifactId>UserAgentUtils</artifactId>
        <version>1.21</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>1.4.1.RELEASE</version>
    </dependency>
</dependencies>

<build>
    <finalName>${finalName}</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <executable>true</executable>
            </configuration>
        </plugin>
    </plugins>
</build>

</project>

जवाब

1 shengyan Aug 30 2020 at 05:14

वास्तव में spring-boot-starter-parentहोते हैं spring-boot-autoconfigure, देखते हैंhttps://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent/2.3.3.RELEASEके लिए प्रबंधित निर्भरता ।

यदि आप इस संस्करण को विशेष रूप से निर्दिष्ट करते हैं (अर्थात, दो अलग-अलग संस्करण हैं), तो एक त्रुटि हो सकती है।