grails run-war 导致 SLF4J : Class path contains multiple SLF4J bindings

标签 grails slf4j grails-plugin grails-2.0 slf4j-api

我正在使用 grails 2.4.2 版本。当我运行命令 run-app 时,应用程序运行良好,Intellij 控制台中没有错误。当我运行命令 prod run-app 时,它也可以正常工作而不会出错。但是当我运行命令 run-war 时,会出现以下错误。我已经搜索过了,但没有解决方案适用于我的情况,或者我可能不理解。
这是我在 Intellij 控制台中的错误:

    |Done creating WAR target\alhikmah-0.1.war
|Running Grails application
Error |
SLF4J: Class path contains multiple SLF4J bindings.
Error |
SLF4J: Found binding in [jar:file:/C:/Users/aina/.m2/repository/org/grails/grails-plugin-log4j/2.4.2/grails-plugin-log4j-2.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Error |
SLF4J: Found binding in [jar:file:/D:/projects/alhikmah/target/work/tomcat/webapps/alhikmah/WEB-INF/lib/grails-plugin-log4j-2.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Error |
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Error |
SLF4J: Actual binding is of type [org.slf4j.impl.GrailsSlf4jLoggerFactory]
Error |
log4j:WARN No appenders could be found for logger (org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener).
Error |
log4j:WARN Please initialize the log4j system properly.
Error |
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.MalformedParameterizedTypeException
    at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:387)
    at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:114)
    at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:72)
    at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:56)
    at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1131)
    at java.beans.Introspector.getBeanInfo(Introspector.java:414)
    at java.beans.Introspector.getBeanInfo(Introspector.java:161)
    ... 5 more
Error listenerStart
Context [/alhikmah] startup failed due to previous errors
The web application [/alhikmah] registered the JDBC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
The web application [/alhikmah] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
The web application [/alhikmah] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
|Server running. Browse to http://localhost:8080/alhikmah
|Server running. Browse to http://localhost:8080/alhikmah

最佳答案

升级您的 Grails 版本可能会解决您的问题。
升级程序

  • 项目 -> 清洁
  • application.properties -> 更改 app.grails.version =(新版本)
  • 您的项目 -> 属性 -> Grails -> 将 grails 安装更改为新的 grails 版本。
  • 你的项目 -> Grails 工具 -> 刷新依赖
  • 运行您的项目

  • 或者看看Grails Upgrade

    关于grails run-war 导致 SLF4J : Class path contains multiple SLF4J bindings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44348098/

    相关文章:

    java - Controller 单元测试如何使用返回类型 ValueOperations 模拟 RedisTemplate opsForValue

    java - 有多个 SLF4J 绑定(bind)时如何使用 SLF4J

    hibernate - 如何控制 Hibernate 的日志记录?

    java - 彩色日志输出,不解析 log4j.properties 中的 '%highlight{...}{..}'

    grails - 使用 springSecurity 制作 grails 应用程序的索引 UI

    grails - Grails 2.1.0插件传递依赖项

    grails - Grails中提供了不错的工作流程插件

    grails - 使用Grails Acegi-Plugin并在身份验证时需要其他检查

    grails - grailsApplication.config.grails.binRange 处的代码失败。任何人都可以解决这个问题?

    hibernate - Grails错误 “violates foreign key constraint”在尝试一次保存多个对象时无法添加对象