刚刚尝试使用Neo4j Grails插件并遇到了一些问题。
Fixed the first myself - 它可以找到ne04j-jdbc
依赖项。将mavenRepo http://m2.neo4j.org/releases添加到存储库并修复了该问题。
然后我创建了一个域类和集成测试。跑了测试,但它失败并发出关于会话等的警告,所以我删除了hibernate
插件和db-migration
插件。
我现在收到这样的错误
....Caused by: java.lang.ClassNotFoundException: org.grails.datastore.mapping.query.api.BuildableCriteria
那么这个班级在哪里,为什么会丢失?
如果我重新添加hibernate
插件并重新运行,我会收到类似的错误。无论哪种方式,我的测试都行不通。任何的想法?我不需要hibernate
,但我想尝试使用neo4j
Error running forked test-app: No bean named 'sessionFactory' is defined
在BuildConfig.groovy
我安装了以下插件:
plugins {...
compile ":neo4j:2.0.0-M02"
}
仍然在构建中的hibernate
的Stacktrace看起来像:
Loading Grails 2.4.4
|Configuring classpath
.
|Environment set to test
...................................
|Running without daemon...
............................................Error
|
Fatal error running tests: No bean named 'sessionFactory' is defined (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:641)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1157)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:280)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:271)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.BeanFactory$getBean.call(Unknown Source)
at org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator.postProcessBeanFactory(PersistenceContextInterceptorAggregator.groovy:104)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:611)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
Error |
Fatal error running tests: No bean named 'sessionFactory' is defined
.Tests FAILED
|
- view reports in E:\workspace\ggts3.6.2-workspace\Neo4jTest\target\test-reports
Error |
Error running forked test-app: No bean named 'sessionFactory' is defined (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:641)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1157)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:280)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:271)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.BeanFactory$getBean.call(Unknown Source)
at org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator.postProcessBeanFactory(PersistenceContextInterceptorAggregator.groovy:104)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:611)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
Error |
Error running forked test-app: No bean named 'sessionFactory' is defined
Error |
Forked Grails VM exited with error
`
if I disable the hibernate plugin and re run the test I get this
`
|Loading Grails 2.4.4
|Configuring classpath
.
|Environment set to test
..................................
|Running without daemon...
...........................................Error
|
Fatal error running tests: org/grails/datastore/mapping/query/api/BuildableCriteria (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NoClassDefFoundError: org/grails/datastore/mapping/query/api/BuildableCriteria
at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:56)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
Caused by: java.lang.ClassNotFoundException: org.grails.datastore.mapping.query.api.BuildableCriteria
... 3 more
Error |
Fatal error running tests: org/grails/datastore/mapping/query/api/BuildableCriteria
.Tests FAILED
|
- view reports in E:\workspace\ggts3.6.2-workspace\Neo4jTest\target\test-reports
Error |
Error running forked test-app: org/grails/datastore/mapping/query/api/BuildableCriteria (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NoClassDefFoundError: org/grails/datastore/mapping/query/api/BuildableCriteria
at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:56)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
Caused by: java.lang.ClassNotFoundException: org.grails.datastore.mapping.query.api.BuildableCriteria
... 3 more
Error |
Error running forked test-app: org/grails/datastore/mapping/query/api/BuildableCriteria
Error |
Forked Grails VM exited with error
我的集成测试看起来像这样:
package com.softwood
import grails.test.spock.IntegrationSpec
class PersonIntegrationSpec extends IntegrationSpec {
def setup() {
}
def cleanup() {
}
void "test create"() {
given : "create a person"
def p = new Person (firstName: "william", lastName: "woodman", dateOfBirth : new Date())
when: "save him"
p.neo4j.save (failOnError : true)
then:
p.id
def res = Person.neo4j.get(p.id)
res.firstName == "william"
}
}