1

我已经导入了一个 Grails 项目,并试图“将其转换为 grails”。当我这样做时,我在 apache commons 日志记录包上得到一个 NoClassDefFound。我在哪里添加这个 jar?这是在 IDE 的类路径、Grails 类路径还是应用程序的类路径中?它似乎没有在 grails-2.2.4/lib 中。这是我期望的第一个地方。这似乎使用了 Ivy,所以它应该作为依赖项出现吗?下面是我看到的错误:

Loading Grails 2.2.4
| Error java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
| Error     at org.codehaus.groovy.grails.io.support.PathMatchingResourcePatternResolver.<clinit>(PathMatchingResourcePatternResolver.java:136)
| Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.getAvailableScripts(GrailsScriptRunner.java:813)
| Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:423)
| Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:417)
| Error     at org.grails.ide.api.impl.GrailsConnectorImpl.executeCommand(GrailsConnectorImpl.java:160)
| Error     at org.grails.ide.eclipse.longrunning.process.GrailsProcess.run(GrailsProcess.java:130)
| Error     at org.grails.ide.eclipse.longrunning.process.GrailsProcess.main(GrailsProcess.java:93)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:483)
| Error     at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
| Error     at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
| Error     at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
| Error     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
| Error     at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
| Error     at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:52)
| Error     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
| Error     ... 13 more
4

1 回答 1

1

Remove jdk1.8. I had both 1.7 and 1.8 jdks installed and 1.8 was my default runtime for osx. The project was specified as 1.7 but GGTS is looking at the default java runtime. After removing 1.8, it all works as expected.

于 2014-11-28T18:21:01.500 回答