RepositoryConnection Commit Fails on dataload

Hello, I’m back with another question. I have successfully connected to my remote Stardog server and am able to create and initialize a Repository and a RepositoryConnection. I can use the AdminConnection.list() method to see my databases successfully, so I know that the connection worked to some degree. I am also able to successfully query the database using the RepositoryConnection.prepareBooleanQuery() method. So it seems that most Read operations are a go.

However, I have been unable to load data into the database. Here is the code I am using:

val repo: StardogRepository = new 
StardogRepository(ConnectionConfiguration.to("myDB").server("http://myIP:myPort").credentials("admin", "admin"))
repo.initialize()
val cxn: RepositoryConnection = repo.getConnection()
val f: ValueFactory = cxn.getValueFactory()
RepositoryConnections.add(cxn, new File("synthesized_300.ttl"))

The last line is the one which causes the following error:

14:04:46.220 [pool-63-thread-4-ScalaTest-running-StardogConnection] WARN  c.c.s.p.http.client.BaseHttpClient - No response from server, will retry (tries: 1)
14:04:46.251 [pool-63-thread-4-ScalaTest-running-StardogConnection] WARN  c.c.s.p.http.client.BaseHttpClient - No response from server, will retry (tries: 1)
14:04:46.689 [pool-63-thread-4-ScalaTest-running-StardogConnection] WARN  c.c.s.p.http.client.BaseHttpClient - No response from server, will retry (tries: 1)
14:04:46.751 [pool-63-thread-4-ScalaTest-running-StardogConnection] WARN  c.c.s.p.http.client.BaseHttpClient - No response from server, will retry (tries: 1)
14:04:46.783 [pool-63-thread-4-ScalaTest-running-StardogConnection] WARN  c.c.s.p.http.client.BaseHttpClient - No response from server, will retry (tries: 1)
14:04:46.798 [pool-63-thread-4-ScalaTest-running-StardogConnection] WARN  c.c.s.p.http.client.BaseHttpClient - No response from server, will retry (tries: 1)
14:04:46.861 [pool-63-thread-4-ScalaTest-running-StardogConnection] ERROR c.c.s.s.StardogRepositoryConnection - Commit failed
com.complexible.stardog.StardogException: org.apache.http.client.ClientProtocolException
        at com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:86)
        at com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:34)
        at com.complexible.stardog.api.impl.SPECConnection.applyChanges(SPECConnection.java:335)
        at com.complexible.stardog.api.impl.AbstractConnection.pushOutstanding(AbstractConnection.java:308)
        at com.complexible.stardog.api.impl.AbstractConnection.commit(AbstractConnection.java:206)
        at com.complexible.stardog.api.impl.DelegatingConnection.commit(DelegatingConnection.java:114)
        at com.complexible.stardog.api.impl.DelegatingConnection.commit(DelegatingConnection.java:114)
        at com.complexible.stardog.sesame.StardogRepositoryConnection.commit(StardogRepositoryConnection.java:453)
        at com.complexible.common.openrdf.repository.RepositoryConnections.add(RepositoryConnections.java:155)
        at com.complexible.common.openrdf.repository.RepositoryConnections.add(RepositoryConnections.java:125)
        at com.complexible.common.openrdf.repository.RepositoryConnections.add(RepositoryConnections.java:121)
        at com.complexible.common.openrdf.repository.RepositoryConnections.add(RepositoryConnections.java:117)
        at com.example.app.StardogConnection$$anonfun$1.apply$mcV$sp(TheStardogConnection.scala:58)
        at com.example.app.StardogConnection$$anonfun$1.apply(TheStardogConnection.scala:49)
        at com.example.app.StardogConnection$$anonfun$1.apply(TheStardogConnection.scala:49)
        at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
        at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
        at org.scalatest.Transformer.apply(Transformer.scala:22)
        at org.scalatest.Transformer.apply(Transformer.scala:20)
        at org.scalatest.FunSuiteLike$$anon$1.apply(FunSuiteLike.scala:186)
        at org.scalatest.TestSuite$class.withFixture(TestSuite.scala:196)
        at com.example.app.StardogConnection.withFixture(TheStardogConnection.scala:46)
        at org.scalatest.FunSuiteLike$class.invokeWithFixture$1(FunSuiteLike.scala:183)
        at org.scalatest.FunSuiteLike$$anonfun$runTest$1.apply(FunSuiteLike.scala:196)
        at org.scalatest.FunSuiteLike$$anonfun$runTest$1.apply(FunSuiteLike.scala:196)
        at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
        at org.scalatest.FunSuiteLike$class.runTest(FunSuiteLike.scala:196)
        at com.example.app.StardogConnection.runTest(TheStardogConnection.scala:46)
        at org.scalatest.FunSuiteLike$$anonfun$runTests$1.apply(FunSuiteLike.scala:229)
        at org.scalatest.FunSuiteLike$$anonfun$runTests$1.apply(FunSuiteLike.scala:229)
        at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:396)
        at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:384)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
        at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:379)
        at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
        at org.scalatest.FunSuiteLike$class.runTests(FunSuiteLike.scala:229)
        at com.example.app.StardogConnection.runTests(TheStardogConnection.scala:46)
        at org.scalatest.Suite$class.run(Suite.scala:1147)
        at com.example.app.StardogConnection.org$scalatest$FunSuiteLike$$super$run(TheStardogConnection.scala:46)
        at org.scalatest.FunSuiteLike$$anonfun$run$1.apply(FunSuiteLike.scala:233)
        at org.scalatest.FunSuiteLike$$anonfun$run$1.apply(FunSuiteLike.scala:233)
        at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
        at org.scalatest.FunSuiteLike$class.run(FunSuiteLike.scala:233)
        at com.example.app.StardogConnection.run(TheStardogConnection.scala:46)
        at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:314)
        at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:480)
        at sbt.TestRunner.runTest$1(TestFramework.scala:76)
        at sbt.TestRunner.run(TestFramework.scala:85)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:202)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:202)
        at sbt.TestFramework$.sbt$TestFramework$$withContextLoader(TestFramework.scala:185)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:202)
        at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:202)
        at sbt.TestFunction.apply(TestFramework.scala:207)
        at sbt.Tests$.sbt$Tests$$processRunnable$1(Tests.scala:239)
        at sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:245)
        at sbt.Tests$$anonfun$makeSerial$1.apply(Tests.scala:245)
        at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:44)
        at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:44)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: com.complexible.common.protocols.client.ClientException: org.apache.http.client.ClientProtocolException
        at com.complexible.stardog.protocols.http.client.BaseHttpClient.execute(BaseHttpClient.java:330)
        at com.complexible.stardog.protocols.http.client.HttpClientImpl.add(HttpClientImpl.java:460)
        at com.complexible.stardog.protocols.http.client.HttpClientImpl.add(HttpClientImpl.java:100)
        at com.complexible.stardog.api.impl.SPECConnection.change(SPECConnection.java:342)
        at com.complexible.stardog.api.impl.SPECConnection.applyChanges(SPECConnection.java:316)
        ... 72 common frames omitted
Caused by: org.apache.http.client.ClientProtocolException: null
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
        at com.complexible.stardog.protocols.http.client.BaseHttpClient.executeRaw(BaseHttpClient.java:340)
        at com.complexible.stardog.protocols.http.client.BaseHttpClient.execute(BaseHttpClient.java:323)
        ... 76 common frames omitted
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:107)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        ... 79 common frames omitted
Caused by: java.net.SocketException: Connection reset by peer: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(Unknown Source)
        at java.net.SocketOutputStream.write(Unknown Source)
        at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:126)
        at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:138)
        at org.apache.http.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:169)
        at org.apache.http.impl.io.ChunkedOutputStream.flushCacheWithAppend(ChunkedOutputStream.java:124)
        at org.apache.http.impl.io.ChunkedOutputStream.write(ChunkedOutputStream.java:181)
        at org.apache.http.entity.BasicHttpEntity.writeTo(BasicHttpEntity.java:119)
        at org.apache.http.impl.execchain.RequestEntityProxy.writeTo(RequestEntityProxy.java:123)
        at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:158)
        at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:162)
        at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:237)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:122)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
        ... 81 common frames omitted

Any thoughts on how I can go about debugging? I thought that it might be some sort of security setting on my database, but my admin user seems to have full privileges.

Hi,

I am not able to reproduce this error locally in Java. The “Connection reset by peer: socket write error” message implies that there might be some sort of firewall issue. Is “myIP” your local machine, or a remote server?

Hey Stephen, “myIP” is a remote server. Perhaps there are some security settings which are preventing my connection from going through.

One of the more common issues of this nature is with CORS. It’s enabled by default on the Stardog server, so you’ll likely need to edit your stardog.properties file either to disable it for testing (cors.enabled=false) or to allow your request through (cors.allowed.origins=http://your.local.machine), then restart Stardog.

I created the file “stardog.properties” in my STARDOG_HOME directory with the following text:

cors.enabled = false

I then restarted the Stardog server. Unfortunately I still was not able to connect and got the same error as before. Is there some way to confirm that my properties file effectively set the value for cors.enabled?

How large is the “synthesized_300.ttl” file you’re attempting to add?

Also, to clarify, are you running Stardog 5.0.1?

Hi Stephen,

Yes, I am running Stardog 5.0.1, community edition. The size of the file “synthesized_300.ttl” is 1.27 megabytes. It contains approximately 20,000 RDF triples.

I will test with a smaller file and see if that helps matters.

Update: I spun up another Stardog server on a virtualbox and was able to successfully execute my data load. So I suspect the problem is with some sort of permissions or security exception on the specific remote server I was using, and not a Stardog problem.

Thanks for the help anyway, Stephen.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.