Grails 3.3.2 - ERROR --- [main] o.s.boot.SpringApplication:应用程序启动失败

时间:2018-01-26 07:05:30

标签: grails

当我启动grails 3.3.2 plugin时,会出现此错误。

版本:

IDE:IntelliJ

Grails:3.3.2

Gorm:6.1.8

PropertySourceLoader:org.springframework.boot:spring-boot-autoconfigure:1.5.8.RELEASE

2018-01-25 14:03:25.920 ERROR --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.IllegalArgumentException: Unable to instantiate factory class: org.springframework.boot.env.PropertySourceLoader
at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:142)
at org.springframework.core.io.support.SpringFactoriesLoader.loadFactories(SpringFactoriesLoader.java:93)
at org.springframework.boot.env.PropertySourcesLoader.<init>(PropertySourcesLoader.java:65)
at org.springframework.boot.env.PropertySourcesLoader.<init>(PropertySourcesLoader.java:54)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:352)
at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:225)
at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:195)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:182)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:168)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
at grails.boot.GrailsApp.run(GrailsApp.groovy:387)
at grails.boot.GrailsApp.run(GrailsApp.groovy:374)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at pap_mailgv332.Application.main(Application.groovy:10)
Caused by: java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/YamlProcessor
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:132)
... 24 common frames omitted
 Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.config.YamlProcessor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 38 common frames omitted


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
 Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe'' finished with non-zero exit value 1

 * Try:
Run with --stacktrace option to get the stack trace. Run with --info or   --debug option to get more log output.
Error |
Failed to start server (Use --stacktrace to see the full trace)

application.yml:

grails:
profile: plugin
codegen:
    defaultPackage: eliotXDDDDDDD
spring:
    transactionManagement:
        proxies: false
gorm:
    reactor:
        # Whether to translate GORM events into Reactor events
        # Disabled by default for performance reasons
        events: false
info:
app:
    name: 'eliotXDDDDD'
    version: '17.0.1'
    grailsVersion: '3.3.2'
spring:
main:
    banner-mode: "off"
groovy:
    template:
        check-template-location: false

# Spring Actuator Endpoints are Disabled by Default
endpoints:
enabled: false
jmx:
    enabled: true

2 个答案:

答案 0 :(得分:0)

您的application.yml格式错误。 yml属性范围取决于制表符/空格对齐。尝试以下方法:

grails:
    profile: plugin
    codegen:
        defaultPackage: eliotXDDDDD
    spring:
        transactionManagement:
            proxies: false
    gorm:
        reactor:
            # Whether to translate GORM events into Reactor events
            # Disabled by default for performance reasons
            events: false
info:
    app:
        name: 'eliotXDDDDD'
        version: '17.0.1'
        grailsVersion: '3.3.2'
spring:
    main:
        banner-mode: "off"
    groovy:
        template:
            check-template-location: false

# Spring Actuator Endpoints are Disabled by Default
endpoints:
    enabled: false
    jmx:
        enabled: true

答案 1 :(得分:0)

我用spring-beans版本解决了错误:4.3.12