【问题标题】:Error in running java application file with spring boot使用 spring boot 运行 java 应用程序文件时出错
【发布时间】:2020-12-17 09:21:20
【问题描述】:

我无法运行作为工作评估提供给我的应用程序。我按照他们的指示运行该应用程序,但出现此错误。他们的指示只是为数据库添加用户和密码。我找不到哪个错误是因为我是 Spring 框架的新手。我在 intellij IDEA Ultimate 上运行它。


 2020-08-28 15:18:09.347  INFO gr.publicsoft.springbootcrud.Application:50 - Starting Application on 
LAPTOP-79766038 with PID 6032 (C:\Users\GeorgeD\IdeaProjects\public-soft-springbootcrud- 
c061f40d0dbf\springbootcrud-webapp\target\classes started by GeorgeD in 
C:\Users\GeorgeD\IdeaProjects\public-soft-springbootcrud-c061f40d0dbf)
2020-08-28 15:18:09.349  INFO gr.publicsoft.springbootcrud.Application:679 - The following profiles 
are active: dev
2020-08-28 15:18:09.389  INFO 
org.springframework.boot.devtools.env.DevToolsPropertyDefaultsPostProcessor:227 - Devtools property 
defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-08-28 15:18:09.389  INFO 
org.springframework.boot.devtools.env.DevToolsPropertyDefaultsPostProcessor:227 - For additional web 
related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-08-28 15:18:09.501 ERROR org.springframework.boot.SpringApplication:858 - Application run failed
java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedDataBinder
   at 


  org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector
 .getExcludeAutoConfigurations 
     Property(EnableAutoConfigurationImportSelector.java:179) at
 org.springframework.boot.autoconfigure.
 EnableAutoConfigurationImportSelector.getExclusions(EnableAutoConfigurationImportSelector.java:172)
 at 
 org.springframework.boot.autoconfigure.
 EnableAutoConfigurationImportSelector.selectImports(EnableAutoConfigurationImportSelector.java:87)
 at 
 org.springframework.context.annotation.
 ConfigurationClassParser$DefaultDeferredImportSelectorGroup.
 process(ConfigurationClassParser.java:892) at org.springframework.context.annotation.
ConfigurationClassParser$DeferredImportSelectorGrouping.
getImports(ConfigurationClassParser.java:878) at 
org.springframework.context.annotation. 
ConfigurationClassParser$DeferredImportSelectorGroupingHandler.
processGroupImports(ConfigurationClassParser.java:804) at org.springframework.context.annotation.
ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:774)
 at org.springframework.context.annotation.ConfigurationClassParser.
 parse(ConfigurationClassParser.java:185) at 
 org.springframework.context.annotation.ConfigurationClassPostProcessor.
processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) at 
org.springframework.context.annotation.ConfigurationClassPostProcessor.
postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) at 
org.springframework.context.support.PostProcessorRegistrationDelegate.
invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) at 
org.springframework.context.support.
PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors
(PostProcessorRegistrationDelegate.java:95)
at org.springframework.context.support.AbstractApplicationContext.
invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) at 
org.springframework.context.support.AbstractApplicationContext.refresh
(AbstractApplicationContext.java:531)at org.springframework.boot.web.servlet.
context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at gr.publicsoft.springbootcrud.Application.main(Application.java:10)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.
invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedDataBinder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 26 common frames omitted

   ---------------------------------------------------------------
    pom.xml inside 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>

---------------------------------------------------------
 Second  pom.xml 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 或 build.gradle,这纯粹是类路径依赖问题
  • 我刚刚分享了 Prasanth Rajendran 谢谢。他们向我发送了安装 OpenJDK 1.8 的说明
  • 但是还是有这个错误。我下载了openjdk 1.8,没有任何反应。

标签: java mysql spring spring-boot intellij-idea


【解决方案1】:

检查您的 bulid 工具 maven 或 gradle,如果您的 javae 缺少任何依赖项?

由于我通常使用 maven,我发现有时您需要单击最上方的 mvn install 按钮,该软件包将开始下载到您的本地存储库

【讨论】:

  • 我刚刚添加了 pom.xml。感谢您的信息
【解决方案2】:

在某些依赖项上应该与版本发生冲突。可能会尝试更改 spring-boot 版本(降级)。

【讨论】:

  • 这可能是评论而不是答案
  • 我刚刚添加了 pom.xml。感谢您的建议
猜你喜欢
  • 2017-02-18
  • 1970-01-01
  • 1970-01-01
  • 2023-01-28
  • 2015-04-18
  • 2020-08-27
相关资源
最近更新 更多