【发布时间】:2015-03-22 03:40:29
【问题描述】:
环境:Windows 7、JDK1.7、GGTS 3.6.1,数据库:Postgres 9.3、Grails 2.4.3
与 run-app 一起使用时,系统似乎启动并运行良好。 当我使用 run-war 时,它会构建 war 文件,并在运行应用程序期间抛出异常,附在下面。 (java.lang.NoClassDefFoundError:无法初始化类 grails.util.Holders) 当我查看 buildconfig.groovy 并删除了我为该应用程序所需的 jar 文件的依赖项添加的几个条目时。这些罐子是我开发的,有产品特定的代码。一旦删除,系统就会启动,没有任何异常。 这些 jars 有 java 类文件(不是 groovy),这些是使用 JDK 1.7 开发的。 这些类文件在应用程序中使用(特定于产品) 已添加 postgres 数据库,而不是默认数据库。 依赖的 jars 是我们内部的 repo 的一部分。 为了确保应用程序没有问题,我创建了一个示例应用程序并尝试了 run-war;它似乎工作正常。当我在构建配置中添加这些依赖 jar 条目时,它开始抛出异常。 repo url 已在依赖 jar 的构建配置中使用
例外:
Error | SLF4J: Class path contains multiple SLF4J bindings.
Error | SLF4J: Found binding in [jar:file:/C:/software/grails-2.4.3/dist/grails-plugin-log4j-2.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Error | SLF4J: Found binding in [jar:file:/C:/<loc>/<applicationName>/target/work/tomcat/webapps/<applicationName>/WEB-INF/lib/grails-plugin-log4j-2.4.3.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.springframework.web.context.ContextLoader).
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 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class grails.util.Holders
Caused by: java.lang.NoClassDefFoundError: Could not initialize class grails.util.Holders
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Error listenerStart
Context [/<applicationName>] startup failed due to previous errors
The web application [/<applicationName>] 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 [/<applicationName>] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
【问题讨论】:
标签: grails