我正在使用Neo4J 2.1.5与SDN 3.2.0.RELEASE和Spring 4.1.1.RELEASE
一个存储库包含派生查询:
Landscape getLandscapeByuuid(String landscapeUUID);
间歇性地(并且它是 - 对此方法的一些调用返回适当的对象,一些生成下面的错误,在调用之间没有对数据库进行任何更改),我得到一个loooong错误堆栈跟踪,它开始:
Caused by: java.lang.StackOverflowError: null
at org.neo4j.kernel.impl.core.NodeImpl.getAllRelationshipsOfType(NodeImpl.java:181) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeImpl.getRelationships(NodeImpl.java:241) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.store.PersistenceCache.nodeGetRelationships(PersistenceCache.java:200) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.store.CacheLayer.nodeListRelationships(CacheLayer.java:451) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeGetRelationships(StateHandlingStatementOperations.java:903) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.nodeGetRelationships(ConstraintEnforcingEntityOperations.java:358) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.api.OperationsFacade.nodeGetRelationships(OperationsFacade.java:174) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:170) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:161) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.kernel.impl.core.NodeProxy.getRelationships(NodeProxy.java:76) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.getRelationships(RelationshipHelper.java:182) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.RelatedToViaCollectionFieldAccessorFactory$RelatedToViaCollectionFieldAccessor.loadRelationshipEntities(RelatedToViaCollectionFieldAccessorFactory.java:133) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.RelatedToViaCollectionFieldAccessorFactory$RelatedToViaCollectionFieldAccessor.getValue(RelatedToViaCollectionFieldAccessorFactory.java:120) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.getValue(DefaultEntityState.java:97) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyEntityStatePropertyValue(SourceStateTransmitter.java:90) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.access$000(SourceStateTransmitter.java:40) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter$2.doWithAssociation(SourceStateTransmitter.java:61) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:324) ~[spring-data-commons-1.9.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyPropertiesFrom(SourceStateTransmitter.java:57) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityFetchHandler.fetchValue(Neo4jEntityFetchHandler.java:75) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityFetchHandler.fetch(Neo4jEntityFetchHandler.java:68) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl$1.doWithAssociation(Neo4jEntityConverterImpl.java:135) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:324) ~[spring-data-commons-1.9.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.cascadeFetch(Neo4jEntityConverterImpl.java:125) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.loadEntity(Neo4jEntityConverterImpl.java:114) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.read(Neo4jEntityConverterImpl.java:104) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister$CachedConverter.read(Neo4jEntityPersister.java:170) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.createEntityFromState(Neo4jEntityPersister.java:192) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.Neo4jTemplate.createEntityFromState(Neo4jTemplate.java:224) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.GraphBackedEntityIterableWrapper.underlyingObjectToObject(GraphBackedEntityIterableWrapper.java:41) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.GraphBackedEntityIterableWrapper.underlyingObjectToObject(GraphBackedEntityIterableWrapper.java:27) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.neo4j.helpers.collection.IterableWrapper$MyIteratorWrapper.underlyingObjectToObject(IterableWrapper.java:57) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:382) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:461) ~[neo4j-kernel-2.1.5.jar:2.1.5]
at org.springframework.data.neo4j.fieldaccess.RelatedToViaCollectionFieldAccessorFactory$RelatedToViaCollectionFieldAccessor.getValue(RelatedToViaCollectionFieldAccessorFactory.java:122) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.getValue(DefaultEntityState.java:97) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyEntityStatePropertyValue(SourceStateTransmitter.java:90) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.access$000(SourceStateTransmitter.java:40) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter$2.doWithAssociation(SourceStateTransmitter.java:61) ~[spring-data-neo4j-3.2.0.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:324) ~[spring-data-commons-1.9.0.RELEASE.jar:na]
(http://pastebin.com/k9iMc0cU完全转储)
相关域对象是Landscape - 非常简单。我还包括了它的超类和继承接口。我遇到的重要问题是......为什么上述错误是间歇性的 - 我通常看到的是前两次调用该方法会产生错误,第三次和后续的错误成功... neo4j中的一些缓存问题,也许?
public class Landscape extends GenericPublication {
private String comments;
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
}
public interface IPublication {
public Set<Syndication> getSyndications();
public String getUuid();
public void setComments(String comments);
public void setName(String name);
public void setSyndications(Set<Syndication> syndications);
public void setUuid(String uuid);
}
@NodeEntity
@XmlAccessorType(XmlAccessType.NONE)
public class GenericPublication implements IPublication {
@Fetch
@XmlElement
@RelatedTo(type = "SYNDICATES_TO", direction = Direction.INCOMING)
Set<ArticleCollection> articleCollections = new HashSet<ArticleCollection>();
@Fetch
@XmlElement
String comments;
@Fetch
@XmlElement
String name;
@GraphId
@Fetch
Long nodeId;
@Fetch
@RelatedToVia(type = "SYNDICATES_TO", direction = Direction.INCOMING)
Set<Syndication> syndications;
@Fetch
@XmlElement
@Indexed
String uuid;
public String getComments() {
return comments;
}
public String getName() {
return name;
}
public Set<Syndication> getSyndications() {
return syndications;
}
public String getUuid() {
return uuid;
}
public void setComments(String comments) {
this.comments = comments;
}
public void setName(String name) {
this.name = name;
}
public void setSyndications(Set<Syndication> syndications) {
this.syndications = syndications;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
}
@RelationshipEntity(type = "SYNDICATES_TO")
public class Syndication {
@GraphId
Long nodeId;
@Fetch
@StartNode
@Indexed
ArticleCollection articleCollection;
@Fetch
@EndNode
@Indexed
GenericPublication publication;
@Fetch
@Indexed
String uuid;
@Fetch
Set<String> categories;
public Set<String> getCategories() {
return categories;
}
public void setCategories(Set<String> categories) {
this.categories = categories;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public Long getNodeId() {
return nodeId;
}
public void setNodeId(Long nodeId) {
this.nodeId = nodeId;
}
public ArticleCollection getArticleCollection() {
return articleCollection;
}
public void setArticleCollection(ArticleCollection articleCollection) {
this.articleCollection = articleCollection;
}
public GenericPublication getPublication() {
return publication;
}
public void setPublication(GenericPublication publication) {
this.publication = publication;
}
}
任何想法这里的问题是什么?这是一个直截了当的用例,我很困惑在哪里看......