使用HTTPS时,Neo4j REST抛出异常

时间:2013-06-12 09:58:46

标签: json https neo4j

我创建了一个简单的项目,在neo4j中创建了一个用户树。当我使用标准HTTP协议时,一切正常。一旦我切换到HTTPS应用程序无法检索任何有关系的对象。对象看起来像这样:

@Indexed(indexType=IndexType.SIMPLE, unique=true, indexName="profileIdIDX")
private Long profileId;

// Country where this affiliate exists. -[:LIVESIN]->
@Fetch
@RelatedTo(direction=Direction.OUTGOING,type=RelationTypes.LIVESIN)
private Country country;

// Role of user in affiliate tree
private Integer role;

// Time till this user is eligible to earn affiliate's income
private Long affilElig;

// Time till this user is eligible to earn partner's income
private Long partnElig;

// If user is eligible to get partner's income we need to know his partner level
private Integer partnLvl;  

// Direct reference to patron -[:SUPREME]->
@Fetch
@RelatedTo(direction=Direction.OUTGOING, type=RelationTypes.SUPREME)
private Affiliate patron;

// Collection of users registered in affiliate tree in first line of this user <-[:SUPREME]-
@RelatedTo(direction=Direction.INCOMING, type=RelationTypes.SUPREME, elementClass=Affiliate.class)
private Set<Affiliate> subAffilites;

// If user is a VAT payer we do not calculate VAT tax for his income (depends as well on 
// country.vatRegime). Possible values are {0=do not calculate, 1=calculate}
@Min(value=0, message="calculateVAT cant be less then 0") 
@Max(value=1, message="calculateVAT cant be greather then 1")
private Integer calculateVAT;

尝试通过简单的存储库方法检索它时:

@Query("start n=node:profileIdIDX(profileId={0}) return n")
public Affiliate findByProfileId(Long profileId);

JSON只会抛出此异常:

Error reading as JSON &apos;&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;/&gt;
&lt;title&gt;Error 404 Not Found&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;&lt;h2&gt;HTTP ERROR 404&lt;/h2&gt;
&lt;p&gt;Problem accessing /db/data/node/3/https://my.server.com:7473/db/data/node/3/relationships/out/SUPREME. Reason:
&lt;pre&gt;    Not Found&lt;/pre&gt;&lt;/p&gt;&lt;hr /&gt;&lt;i&gt;&lt;small&gt;Powered by Jetty://&lt;/small&gt;&lt;/i&gt;&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                

&lt;/body&gt;
&lt;/html&gt;
&apos;" type="java.lang.RuntimeException">java.lang.RuntimeException: Error reading as JSON &apos;&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;/&gt;
&lt;title&gt;Error 404 Not Found&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;&lt;h2&gt;HTTP ERROR 404&lt;/h2&gt;
&lt;p&gt;Problem accessing /db/data/node/3/https://my.server.com:7473/db/data/node/3/relationships/out/SUPREME. Reason:
&lt;pre&gt;    Not Found&lt;/pre&gt;&lt;/p&gt;&lt;hr /&gt;&lt;i&gt;&lt;small&gt;Powered by Jetty://&lt;/small&gt;&lt;/i&gt;&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                
&lt;br/&gt;                                                

&lt;/body&gt;
&lt;/html&gt;
&apos;
    at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57)
    at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62)
    at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:114)
    at org.neo4j.rest.graphdb.converter.RelationshipIterableConverter.convertFromRepresentation(RelationshipIterableConverter.java:45)
    at org.neo4j.rest.graphdb.ExecutingRestAPI.wrapRelationships(ExecutingRestAPI.java:310)
    at org.neo4j.rest.graphdb.ExecutingRestAPI.getRelationships(ExecutingRestAPI.java:480)
    at org.neo4j.rest.graphdb.RestAPIFacade.getRelationships(RestAPIFacade.java:197)
    at org.neo4j.rest.graphdb.entity.RestNode.getRelationships(RestNode.java:83)
    at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.getOtherNodes(RelationshipHelper.java:50)
    at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.getStatesFromEntity(RelationshipHelper.java:153)
    at org.springframework.data.neo4j.fieldaccess.RelationshipHelper.createEntitySetFromRelationshipEndNodes(RelationshipHelper.java:127)
    at org.springframework.data.neo4j.fieldaccess.RelatedToFieldAccessor.createEntitySetFromRelationshipEndNodes(RelatedToFieldAccessor.java:86)
    at org.springframework.data.neo4j.fieldaccess.RelatedToSingleFieldAccessorFactory$RelatedToSingleFieldAccessor.getValue(RelatedToSingleFieldAccessorFactory.java:76)
    at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.getValue(DefaultEntityState.java:97)
    at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyEntityStatePropertyValue(SourceStateTransmitter.java:90)
    at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.access$000(SourceStateTransmitter.java:40)
    at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter$2.doWithAssociation(SourceStateTransmitter.java:61)
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:252)
    at org.springframework.data.neo4j.support.mapping.SourceStateTransmitter.copyPropertiesFrom(SourceStateTransmitter.java:57)
    at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.loadEntity(Neo4jEntityConverterImpl.java:100)
    at org.springframework.data.neo4j.support.mapping.Neo4jEntityConverterImpl.read(Neo4jEntityConverterImpl.java:92)
    at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister$CachedConverter.read(Neo4jEntityPersister.java:170)
    at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.createEntityFromState(Neo4jEntityPersister.java:189)
    at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.projectTo(Neo4jEntityPersister.java:216)
    at org.springframework.data.neo4j.support.Neo4jTemplate.projectTo(Neo4jTemplate.java:197)
    at org.springframework.data.neo4j.support.conversion.EntityResultConverter.doConvert(EntityResultConverter.java:68)
    at org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:43)
    at org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:99)
    at org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:36)
    at org.springframework.data.neo4j.rest.SpringRestGraphDatabase$SpringResultConverter.convert(SpringRestGraphDatabase.java:156)
    at org.neo4j.rest.graphdb.util.QueryResultBuilder$1$1.underlyingObjectToObject(QueryResultBuilder.java:98)
    at org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47)
    at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:115)
    at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:260)
    at org.springframework.data.neo4j.rest.SpringEndResult.singleOrNull(SpringEndResult.java:39)
    at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:108)
    at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:81)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:312)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at com.sun.proxy.$Proxy38.findByProfileId(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
    at com.sun.proxy.$Proxy40.findByProfileId(Unknown Source)
    at com.adleritech.test.billing.data.repository.TestAffiliateRepo.test1_persistPatronToGraphDB(TestAffiliateRepo.java:76)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: org.codehaus.jackson.JsonParseException: Unexpected character (&apos;&lt;&apos; (code 60)): expected a valid value (number, String, array, object, &apos;true&apos;, &apos;false&apos; or &apos;null&apos;)
 at [Source: java.io.StringReader@67ca3da6; line: 1, column: 2]
    at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)
    at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198)
    at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485)
    at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770)
    at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
    at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:55)
    ... 88 more

我正在使用Neo4j 1.8.2企业,这是maven项目的依赖树:

[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ billing-data ---
[INFO] com.adleritech.billing:billing-data:jar:1.0-SNAPSHOT
[INFO] +- cglib:cglib:jar:2.2.2:compile
[INFO] |  \- asm:asm:jar:3.3.1:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.3.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:3.2.3.RELEASE:compile
[INFO] |     \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework.data:spring-data-neo4j-rest:jar:2.2.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-tx:jar:3.1.4.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-context:jar:3.1.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-asm:jar:3.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-aspects:jar:3.1.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-context-support:jar:3.1.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.1.4.RELEASE:compile
[INFO] |  +- org.neo4j:neo4j-kernel:jar:1.8.1:compile
[INFO] |  |  \- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] |  +- org.neo4j:neo4j-rest-graphdb:jar:1.8.1:compile
[INFO] |  |  \- org.neo4j:server-api:jar:1.8.1:compile
[INFO] |  |     +- org.neo4j.3rdparty.javax.ws.rs:jsr311-api:jar:1.1.2.r612:compile
[INFO] |  |     +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] |  |     |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  |     |  +- commons-lang:commons-lang:jar:2.4:compile
[INFO] |  |     |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] |  |     \- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] |  |        \- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.7:compile
[INFO] |  |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.7:compile
[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.7:compile
[INFO] |  +- com.sun.jersey:jersey-client:jar:1.4:compile
[INFO] |  |  \- com.sun.jersey:jersey-core:jar:1.4:compile
[INFO] |  +- org.neo4j:neo4j:jar:1.8.1:compile
[INFO] |  |  +- org.neo4j:neo4j-lucene-index:jar:1.8.1:compile
[INFO] |  |  |  \- org.apache.lucene:lucene-core:jar:3.5.0:compile
[INFO] |  |  +- org.neo4j:neo4j-graph-algo:jar:1.8.1:compile
[INFO] |  |  +- org.neo4j:neo4j-udc:jar:1.8.1:compile
[INFO] |  |  +- org.neo4j:neo4j-graph-matching:jar:1.8.1:compile
[INFO] |  |  \- org.neo4j:neo4j-jmx:jar:1.8.1:compile
[INFO] |  +- org.neo4j:neo4j-cypher:jar:1.8.1:compile
[INFO] |  |  +- org.scala-lang:scala-library:jar:2.9.1-1:compile
[INFO] |  |  \- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.3.1:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
[INFO] +- org.springframework.data:spring-data-neo4j:jar:2.2.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:3.1.4.RELEASE:compile
[INFO] |  +- org.aspectj:aspectjrt:jar:1.7.2:compile
[INFO] |  +- org.springframework.data:spring-data-commons:jar:1.5.1.RELEASE:compile
[INFO] |  \- org.neo4j:neo4j-cypher-dsl:jar:1.9.M04:compile
[INFO] +- org.hibernate:hibernate-validator-annotation-processor:jar:4.1.0.Final:compile
[INFO] |  \- org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
[INFO] |     \- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- org.springframework:spring-test:jar:3.2.3.RELEASE:test
[INFO] +- junit:junit:jar:4.11:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:test (scope not updated to compile)
[INFO] \- org.slf4j:slf4j-jdk14:jar:1.6.1:test

1 个答案:

答案 0 :(得分:0)

修复了neo4j-rest-graphdb-1.9.2。 2013年6月20日删除了一个硬编码的“http” https://github.com/neo4j/java-rest-binding/commits/master/src/main/java/org/neo4j/rest/graphdb/ExecutingRestRequest.java