Transactional issues when applying operations to LogisticsObject after ChangeRequeste accepted
Potential source for the error could be not commit transactions, because with repository_type=http
and GraphDB backend, the error does not occur, but GraphDB has hanging transactions.
With repository_type=in-memory
the following example results into the following error:
Create LogisticsObject:
{
"@type": [
"https://onerecord.iata.org/ns/cargo#Piece"
],
"https://onerecord.iata.org/ns/cargo#grossWeight": {
"@type": [
"https://onerecord.iata.org/ns/cargo#Value"
],
"https://onerecord.iata.org/ns/cargo#unit": {
"@id": "https://onerecord.iata.org/ns/coreCodeLists#MeasurementUnitCode_KGM"
},
"https://onerecord.iata.org/ns/cargo#numericalValue": {
"@type": "http://www.w3.org/2001/XMLSchema#double",
"@value": "100.0"
}
}
}
Location: http://localhost:8080/logistics-objects/d83373d8-c68b-438d-8c0d-f035a25ec89d
Get LogisticsObject:
{
"@graph": [
{
"@id": "http://localhost:8080/logistics-objects/d83373d8-c68b-438d-8c0d-f035a25ec89d",
"@type": "Piece",
"grossWeight": {
"@id": "neone:e480b673-31e2-4f06-8bbe-df5d94bb29ef"
}
},
{
"@id": "neone:e480b673-31e2-4f06-8bbe-df5d94bb29ef",
"@type": "Value",
"numericalValue": {
"@type": "http://www.w3.org/2001/XMLSchema#double",
"@value": "100.0"
},
"unit": {
"@id": "https://onerecord.iata.org/ns/coreCodeLists#MeasurementUnitCode_KGM"
}
}
],
"@context": {
"@vocab": "https://onerecord.iata.org/ns/cargo#"
}
}
Update LogisticsObject
{
"@type": [
"https://onerecord.iata.org/ns/api#Change"
],
"https://onerecord.iata.org/ns/api#hasLogisticsObject": {
"@id": "http://localhost:8080/logistics-objects/d83373d8-c68b-438d-8c0d-f035a25ec89d"
},
"https://onerecord.iata.org/ns/api#hasOperation": [
{
"@type": [
"https://onerecord.iata.org/ns/api#Operation"
],
"https://onerecord.iata.org/ns/api#op": {
"@id": "https://onerecord.iata.org/ns/api#DELETE"
},
"https://onerecord.iata.org/ns/api#s": "http://localhost:8080/logistics-objects/d83373d8-c68b-438d-8c0d-f035a25ec89d",
"https://onerecord.iata.org/ns/api#p": "https://onerecord.iata.org/ns/cargo#grossWeight",
"https://onerecord.iata.org/ns/api#o": {
"https://onerecord.iata.org/ns/api#hasDatatype": "https://onerecord.iata.org/ns/cargo#Value",
"https://onerecord.iata.org/ns/api#hasValue": {
"@type": "http://www.w3.org/2001/XMLSchema#string",
"@value": "neone:e480b673-31e2-4f06-8bbe-df5d94bb29ef"
}
}
},
{
"@type": [
"https://onerecord.iata.org/ns/api#Operation"
],
"https://onerecord.iata.org/ns/api#op": {
"@id": "https://onerecord.iata.org/ns/api#DELETE"
},
"https://onerecord.iata.org/ns/api#s": "neone:e480b673-31e2-4f06-8bbe-df5d94bb29ef",
"https://onerecord.iata.org/ns/api#p": "https://onerecord.iata.org/ns/cargo#unit",
"https://onerecord.iata.org/ns/api#o": {
"https://onerecord.iata.org/ns/api#hasDatatype": "https://onerecord.iata.org/ns/cargo#CodeListElement",
"https://onerecord.iata.org/ns/api#hasValue": {
"@type": "http://www.w3.org/2001/XMLSchema#string",
"@value": "https://onerecord.iata.org/ns/coreCodeLists#MeasurementUnitCode_KGM"
}
}
},
{
"@type": [
"https://onerecord.iata.org/ns/api#Operation"
],
"https://onerecord.iata.org/ns/api#op": {
"@id": "https://onerecord.iata.org/ns/api#DELETE"
},
"https://onerecord.iata.org/ns/api#s": "neone:e480b673-31e2-4f06-8bbe-df5d94bb29ef",
"https://onerecord.iata.org/ns/api#p": "https://onerecord.iata.org/ns/cargo#numericalValue",
"https://onerecord.iata.org/ns/api#o": {
"https://onerecord.iata.org/ns/api#hasDatatype": "http://www.w3.org/2001/XMLSchema#double",
"https://onerecord.iata.org/ns/api#hasValue": {
"@type": "http://www.w3.org/2001/XMLSchema#string",
"@value": "100.0"
}
}
},
{
"@type": [
"https://onerecord.iata.org/ns/api#Operation"
],
"https://onerecord.iata.org/ns/api#op": {
"@id": "https://onerecord.iata.org/ns/api#DELETE"
},
"https://onerecord.iata.org/ns/api#s": "neone:e480b673-31e2-4f06-8bbe-df5d94bb29ef",
"https://onerecord.iata.org/ns/api#p": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"https://onerecord.iata.org/ns/api#o": {
"https://onerecord.iata.org/ns/api#hasDatatype": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"https://onerecord.iata.org/ns/api#hasValue": {
"@type": "http://www.w3.org/2001/XMLSchema#string",
"@value": "https://onerecord.iata.org/ns/cargo#Value"
}
}
}
],
"https://onerecord.iata.org/ns/api#hasDescription": {
"@type": "http://www.w3.org/2001/XMLSchema#string",
"@value": "something"
},
"https://onerecord.iata.org/ns/api#hasRevision": {
"@type": "http://www.w3.org/2001/XMLSchema#integer",
"@value": "1"
},
"https://onerecord.iata.org/ns/api#notifyRequestStatusChange": {
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": "false"
}
}
Error:
2023-11-19 16:50:01,018 INFO [org.ope.neo.ser.ActionRequestService] (vert.x-worker-thread-1) Action request [http://localhost:8080/action-requests/502758c4-7a59-40eb-ba1a-cfbaf4e04255] automatically accepted.
2023-11-19 16:50:01,033 WARN [org.ope.neo.rep.RepositoryTransaction] (vert.x-worker-thread-1) Exception during transaction, rolling back transaction: org.openlogisticsfoundation.neone.exception.NeoneException: Cannot find logistics object http://localhost:8080/logistics-objects/5e00c30a-fb92-4bb3-9811-cdbf29e87b93
at org.openlogisticsfoundation.neone.service.LogisticsObjectService.lambda$createSnapshot$24(LogisticsObjectService.java:490)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at org.openlogisticsfoundation.neone.service.LogisticsObjectService.createSnapshot(LogisticsObjectService.java:490)
at org.openlogisticsfoundation.neone.service.LogisticsObjectService.acceptChangeRequest(LogisticsObjectService.java:322)
at org.openlogisticsfoundation.neone.service.LogisticsObjectService.lambda$onChangeRequestUpdated$8(LogisticsObjectService.java:294)
at org.openlogisticsfoundation.neone.repository.RepositoryTransaction.lambda$transactionallyDo$1(RepositoryTransaction.java:47)
at org.openlogisticsfoundation.neone.repository.RepositoryTransaction.transactionallyGet(RepositoryTransaction.java:64)
at org.openlogisticsfoundation.neone.repository.RepositoryTransaction.transactionallyDo(RepositoryTransaction.java:46)
at org.openlogisticsfoundation.neone.repository.RepositoryTransaction_ClientProxy.transactionallyDo(Unknown Source)
at org.openlogisticsfoundation.neone.service.LogisticsObjectService.onChangeRequestUpdated(LogisticsObjectService.java:288)
at org.openlogisticsfoundation.neone.service.LogisticsObjectService_ClientProxy.onChangeRequestUpdated(Unknown Source)
at org.openlogisticsfoundation.neone.service.LogisticsObjectService_VertxInvoker_onChangeRequestUpdated_4625f873faa7a096e68a815ba4134b092ba1a294.invokeBean(Unknown Source)
at io.quarkus.vertx.runtime.EventConsumerInvoker.invoke(EventConsumerInvoker.java:45)
at io.quarkus.vertx.runtime.VertxEventBusConsumerRecorder$3$1$2.call(VertxEventBusConsumerRecorder.java:142)
at io.quarkus.vertx.runtime.VertxEventBusConsumerRecorder$3$1$2.call(VertxEventBusConsumerRecorder.java:138)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$0(ContextBase.java:167)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:277)
at io.vertx.core.impl.ContextBase.lambda$internalExecuteBlocking$2(ContextBase.java:199)
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:840)
GraphDB screenshot: 2023-11-19 16:55:31,109 INFO [org.ope.neo.ser.ActionRequestService] (vert.x-worker-thread-3) Action request [http://localhost:8080/action-requests/42c6854a-88d4-457a-b64f-90cd280aec7c] automatically accepted.