I'm trying to insert a number of nodes using Java REST binding.
This example is from the BatchRestAPITest class in
java-rest-binding-neo4j-rest-graphdb-2.0.0-M06.
In the for loop, i is from 1 to 394. Within this scope, there's no problem.
When it's increased to 395 and more, an Exception is thrown and the nodes
are not created.
The exception is as follows.
It seems like that when returned results from the REST API are more than a
threshold, an IOException is thrown.
I didn't do any settings for this, neo4j is just run as a server.
Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException:java
.io.IOException: Premature EOF
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:
575)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:
517)
at org.neo4j.rest.graphdb.RequestResult.extractFrom(RequestResult.java:87)
at org.neo4j.rest.graphdb.ExecutingRestRequest.post(ExecutingRestRequest.
java:151)
at org.neo4j.rest.graphdb.ExecutingRestAPI.batch(ExecutingRestAPI.java:591)
at org.neo4j.rest.graphdb.batch.BatchRestAPI.executeBatchRequest(
BatchRestAPI.java:135)
at org.neo4j.rest.graphdb.BatchTransaction.close(BatchTransaction.java:79)
at org.neo4j.rest.graphdb.RestAPIFacade.executeBatch(RestAPIFacade.java:312
)
at NodeManager.createNodes(NodeManager.java:131)
at StressTest.createUserNodes(StressTest.java:89)
at StressTest.createNodesRelations(StressTest.java:40)
at MainClass.testStressTest(MainClass.java:34)
at MainClass.main(MainClass.java:47)
Caused by: java.io.IOException: Premature EOF
at sun.net.www.http.ChunkedInputStream.readAheadBlocking(Unknown Source)
at sun.net.www.http.ChunkedInputStream.readAhead(Unknown Source)
at sun.net.www.http.ChunkedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown
Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.Reader.read(Unknown Source)
at com.sun.jersey.core.util.ReaderWriter.readFromAsString(ReaderWriter.java
:171)
at com.sun.jersey.core.util.ReaderWriter.readFromAsString(ReaderWriter.java
:157)
at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.
readFromAsString(AbstractMessageReaderWriterProvider.java:114)
at com.sun.jersey.core.impl.provider.entity.StringProvider.readFrom(
StringProvider.java:73)
at com.sun.jersey.core.impl.provider.entity.StringProvider.readFrom(
StringProvider.java:58)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:
565)
... 12 more
This is the test code. graphDB is an instance of RestGraphDatabase.
RestAPI restAPI = graphDB.getRestAPI();
TestBatchResult response = restAPI.executeBatch(new BatchCallback<
TestBatchResult>() {
@Override
public TestBatchResult recordBatch(RestAPI batchRestApi) {
TestBatchResult result=new TestBatchResult();
result.n1=batchRestApi.createNode(map("name", "node0"));
for (int i=1;i<=394;i++) {
result.n2=batchRestApi.createNode(map("name", "node"+i
));
}
return result;
}
});
Transaction transaction = graphDB.beginTx();
try {
System.out.println("node0 equals: " + "node0".equals(response.n1.
getProperty("name")));
System.out.println("node1000 equals: " + "node1000".equals(response.
n2.getProperty("name")));
} finally {
transaction.success();
transaction.close();
}
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.