我是Grails(和Java)的新手,所以它可能很简单,就像某个地方缺少配置......但是到目前为止我还没有能够获得Google的结果,大多数都是“失败”读取候选组件类“似乎与grails和插件有关,而不是”用户“代码,所以我不认为它是版本问题或插件失败。
我正在尝试在开源OpenTele服务器代码(https://bitbucket.org/4s/opentele-server/src)上运行“grails test-app”,但是在1001个测试用例中大约有20个出现错误。错误都类似于:
Failed to read candidate component class: file [/home/mike/OpenTele/Bitbucket
/4s-opentele-server/target/test-classes/functional/pages/questionnaire/ListPage.class];
nested exception is java.io.FileNotFoundException: class path resource
[pages/ScaffoldPage.class] cannot be opened because it does not exist
我读了这篇文章,因为找不到ScaffoldPage.class文件,但是如果我搜索它,我就能看到它:
mike@ubuntu:10:27:23:~/OpenTele/Bitbucket/4s-opentele-server$ find | grep "ScaffoldPage.class"
./target/test-classes/functional/pages/ScaffoldPage.class
mike@ubuntu:10:27:35:~/OpenTele/Bitbucket/4s-opentele-server$
我正在使用grails 2.1.0。
我得到的错误的完整示例是:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/home/mike/OpenTele/Bitbucket/4s-opentele-server/target/test-classes/functional/pages/questionnaire/ListPage.class]; nested exception is java.io.FileNotFoundException: class path resource [pages/ScaffoldPage.class] cannot be opened because it does not exist
at grails.buildtestdata.mixin.BuildTestDataUnitTestMixin.findDomainSubclasses(BuildTestDataUnitTestMixin.groovy:221)
at grails.buildtestdata.mixin.BuildTestDataUnitTestMixin.findDomainClassesToMock_closure5(BuildTestDataUnitTestMixin.groovy:100)
at grails.buildtestdata.mixin.BuildTestDataUnitTestMixin.findDomainClassesToMock(BuildTestDataUnitTestMixin.groovy:98)
at grails.buildtestdata.mixin.BuildTestDataUnitTestMixin.mockForBuild(BuildTestDataUnitTestMixin.groovy:70)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
at org.spockframework.runtime.extension.builtin.JUnitFixtureMethodsExtension$FixtureType$FixtureMethodInterceptor.intercept(JUnitFixtureMethodsExtension.java:145)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:84)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
Caused by: java.io.FileNotFoundException: class path resource [pages/ScaffoldPage.class] cannot be opened because it does not exist
我尝试运行“grails test-app -clear”,但它没有改变结果......
该程序可以运行“grails run-app”或“grails war”,然后在tomcat中运行。
任何提示都将不胜感激。