在spring boot上启动web应用程序时出错

fcg9iug3  于 2021-07-11  发布在  Java
关注(0)|答案(3)|浏览(794)

我正在尝试创建一个web应用程序。jdk 11服务器payara 5.2020(glassfish)。应用程序几乎是空的。只描述了接口。和配置文件。启动时出错:

[2020-11-17T19:21:17.468+0300] [Payara 5.2020] [SEVERE] [AS-WEB-CORE-00108] [javax.enterprise.web.core] [tid: _ThreadID=117 _ThreadName=admin-thread-pool::admin-listener(1)] [timeMillis: 1605630077468] [levelValue: 1000] [[
  ContainerBase.addChild: start: 
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:283)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:362)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.java:621)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:565)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:556)
  19:21:17.452 [admin-thread-pool::admin-listener(1)] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: 'void org.yaml.snakeyaml.LoaderOptions.setMaxAliasesForCollections(int)'
    at org.springframework.boot.env.OriginTrackedYamlLoader.createYaml(OriginTrackedYamlLoader.java:67)

org.yaml.snakeyaml.loaderoptions.setmaxaliasesforcollections是什么?文件application.yml:

spring:
  datasource:
    default-catalog: library
    jndi-name: jdbc/Library
  jpa:
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
    properties:
      hibernate:
        current_session_context_class: org.springframework.orm.hibernate5.SpringSessionContext
        dialect: org.hibernate.dialect.MySQL5Dialect
        format_sql: true
    show-sql: true

logging:
  file:
    name: c:\logs\app.log
  pattern:
    file: "%d{HH:mm:ss} %-5p [%c] - %m%n"

  level:
    ROOT: error
    org.springframework: warn
    javax.faces: warn
    org.omnifaces: warn
    org.springframework.security: warn
    org.hibernate: trace
    org.hibernate.type.descriptor.sql: trace

可能存在版本冲突的pom.xml文件。也许和jfs有关?

<?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.3.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>ru.javabegin.library</groupId>
    <artifactId>my-library</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>my-library</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>11</java.version>
        <slf4j-api.version>1.7.30</slf4j-api.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <version>2.3.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.4.22.Final</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j-api.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>30.0-jre</version>
        </dependency>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>6.2</version>
        </dependency>
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.omnifaces</groupId>
            <artifactId>omnifaces</artifactId>
            <version>2.5.1</version>
        </dependency>
        <dependency>
            <groupId>net.bootsfaces</groupId>
            <artifactId>bootsfaces</artifactId>
            <version>1.0.0</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons- 
    fileupload/commons-fileupload -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.3</version>
        </dependency>
</project>
bqjvbblv

bqjvbblv1#

我有这个问题。这是由于jfs和spring-boot版本不兼容造成的。我被建议放弃jfs,因为它已经是一种过时的技术了

ubbxdtey

ubbxdtey2#

这可能是因为jdk和spring在构建路径中存在snakeyml版本冲突

js4nwp54

js4nwp543#

你错了 snake-yaml 类库。使用 mvn dependency:tree 分析项目并在发现问题后排除错误的库。

相关问题