Topic creation fails with "Identity value is missing"
I figured out that, in DMX 5.0-beta-5, if one has declared (1) a second identity value as child topic creation via webclient fails with the following error. I created a new ticket since I couldn't find any commit relating to this issue since 5.0-beta-5 and a quick search for a similar issue did not yield any result.
So, the following two error are observer was thrown (server-side) when I tried to create a topic that had multiple identity attributes defined in its type def. Like in the following
{
"value": "Classification System",
"uri": "org.purl.classifications.system",
"dataTypeUri": "dmx.core.identity",
"compDefs": [
{
"childTypeUri": "org.purl.classifications.system_name",
"childCardinalityUri": "dmx.core.one",
"assocTypeUri": "dmx.core.composition_def",
"isIdentityAttr": true,
"includeInLabel": true
},
{
"childTypeUri": "org.purl.classifications.system_id",
"childCardinalityUri": "dmx.core.one",
"assocTypeUri": "dmx.core.composition_def",
"isIdentityAttr": true,
"includeInLabel": true
},
{
"childTypeUri": "org.purl.classifications.system_descr",
"childCardinalityUri": "dmx.core.one",
"assocTypeUri": "dmx.core.composition_def"
}
],
"viewConfigTopics": [
{
"typeUri": "dmx.webclient.view_config",
"children": {
"dmx.webclient.add_to_create_menu": true,
"dmx.webclient.icon": "\uf084"
}
}
]
},
The corresponding stacktrace after trying to create a topic of such via the dmx-webclient:
WARNUNG: ### Rollback transaction of systems.dmx.webservice.WebservicePlugin#createTopic()
Okt 26, 2019 4:06:03 PM systems.dmx.core.util.UniversalExceptionMapper logException
SCHWERWIEGEND: Request "POST /core/topic" failed. Responding with 500 (Internal Server Error). The original exception/error is:
java.lang.RuntimeException: Creating topic failed, model=TopicModelImpl {
"id": -1,
"typeUri": "org.purl.classifications.system",
"children": {"org.purl.classifications.system_name": {
"id": 4162,
"typeUri": "org.purl.classifications.system_name",
"value": "Yea",
"children": {}
}}
}
at systems.dmx.core.impl.AccessLayer.createTopic(AccessLayer.java:134)
at systems.dmx.core.impl.CoreServiceImpl.createTopic(CoreServiceImpl.java:129)
at systems.dmx.core.impl.CoreServiceImpl.createTopic(CoreServiceImpl.java:33)
at systems.dmx.webservice.WebservicePlugin.createTopic(WebservicePlugin.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1480)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1411)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1350)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:339)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:300)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:93)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:50)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:76)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:49)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Value integration failed, newValues=TopicModelImpl {
"id": -1,
"typeUri": "org.purl.classifications.system",
"children": {"org.purl.classifications.system_name": {
"id": 4162,
"typeUri": "org.purl.classifications.system_name",
"value": "Yea",
"children": {}
}}
}, targetObject=null, compDef=null
at systems.dmx.core.impl.ValueIntegrator.integrate(ValueIntegrator.java:111)
at systems.dmx.core.impl.AccessLayer.updateValues(AccessLayer.java:832)
at systems.dmx.core.impl.AccessLayer.createTopic(AccessLayer.java:132)
... 54 more
Caused by: java.lang.RuntimeException: Selecting identity children [org.purl.classifications.system_name, org.purl.classifications.system_id] failed, childValues={org.purl.classifications.system_name=UnifiedValue {
"value": {
"id": 4162,
"uri": "",
"typeUri": "org.purl.classifications.system_name",
"value": "Yea",
"children": {"dmx.workspaces.workspace#dmx.workspaces.workspace_assignment": {
"id": 1535,
"uri": "dmx.workspaces.dmx",
"typeUri": "dmx.workspaces.workspace",
"value": "DMX",
"children": {},
"assoc": {
"id": 4165,
"uri": "",
"typeUri": "dmx.workspaces.workspace_assignment",
"value": "",
"children": {},
"player1": {
"topicId": 4162,
"roleTypeUri": "dmx.core.parent"
},
"player2": {
"topicId": 1535,
"roleTypeUri": "dmx.core.child"
}
}
}}
},
"originalId": -1
}}
at systems.dmx.core.impl.ValueIntegrator.identityChildTopics(ValueIntegrator.java:391)
at systems.dmx.core.impl.ValueIntegrator.identifyParent(ValueIntegrator.java:344)
at systems.dmx.core.impl.ValueIntegrator.unifyComposite(ValueIntegrator.java:312)
at systems.dmx.core.impl.ValueIntegrator.integrateComposite(ValueIntegrator.java:259)
at systems.dmx.core.impl.ValueIntegrator.integrate(ValueIntegrator.java:103)
... 56 more
Caused by: java.lang.RuntimeException: Identity value "org.purl.classifications.system_id" is missing in [org.purl.classifications.system_name] (childTopic=null)
at systems.dmx.core.impl.ValueIntegrator.identityChildTopics(ValueIntegrator.java:379)
... 60 more
I suppose that is due to the webclient only initializing the first child type value when sending a request to create a topic and no identity value is provided for creation.
After reducing the number of identityAttributes to one and altering my migrations file to the following typeDef, topic creation via webclient still failed:
{
"value": "Classification System",
"uri": "org.purl.classifications.system",
"dataTypeUri": "dmx.core.identity",
"compDefs": [
{
"childTypeUri": "org.purl.classifications.system_name",
"childCardinalityUri": "dmx.core.one",
"assocTypeUri": "dmx.core.composition_def",
"includeInLabel": true
},
{
"childTypeUri": "org.purl.classifications.system_id",
"childCardinalityUri": "dmx.core.one",
"assocTypeUri": "dmx.core.composition_def",
"isIdentityAttr": true,
"includeInLabel": true
},
{
"childTypeUri": "org.purl.classifications.system_descr",
"childCardinalityUri": "dmx.core.one",
"assocTypeUri": "dmx.core.composition_def"
}
],
"viewConfigTopics": [
{
"typeUri": "dmx.webclient.view_config",
"children": {
"dmx.webclient.add_to_create_menu": true,
"dmx.webclient.icon": "\uf084"
}
}
]
},
With the server throwing the following stacktrace:
Okt 26, 2019 5:14:11 PM systems.dmx.core.util.UniversalExceptionMapper logException
SCHWERWIEGEND: Request "POST /core/topic" failed. Responding with 500 (Internal Server Error). The original exception/error is:
java.lang.RuntimeException: Creating topic failed, model=TopicModelImpl {
"id": -1,
"typeUri": "org.purl.classifications.system",
"children": {"org.purl.classifications.system_name": {
"id": 4172,
"typeUri": "org.purl.classifications.system_name",
"value": "Test",
"children": {}
}}
}
at systems.dmx.core.impl.AccessLayer.createTopic(AccessLayer.java:134)
at systems.dmx.core.impl.CoreServiceImpl.createTopic(CoreServiceImpl.java:129)
at systems.dmx.core.impl.CoreServiceImpl.createTopic(CoreServiceImpl.java:33)
at systems.dmx.webservice.WebservicePlugin.createTopic(WebservicePlugin.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1480)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1411)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1350)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:339)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:300)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:93)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:50)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:76)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:49)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Value integration failed, newValues=TopicModelImpl {
"id": -1,
"typeUri": "org.purl.classifications.system",
"children": {"org.purl.classifications.system_name": {
"id": 4172,
"typeUri": "org.purl.classifications.system_name",
"value": "Test",
"children": {}
}}
}, targetObject=null, compDef=null
at systems.dmx.core.impl.ValueIntegrator.integrate(ValueIntegrator.java:111)
at systems.dmx.core.impl.AccessLayer.updateValues(AccessLayer.java:832)
at systems.dmx.core.impl.AccessLayer.createTopic(AccessLayer.java:132)
... 54 more
Caused by: java.lang.RuntimeException: Selecting identity children [org.purl.classifications.system_id] failed, childValues={org.purl.classifications.system_name=UnifiedValue {
"value": {
"id": 4172,
"uri": "",
"typeUri": "org.purl.classifications.system_name",
"value": "Test",
"children": {"dmx.workspaces.workspace#dmx.workspaces.workspace_assignment": {
"id": 1535,
"uri": "dmx.workspaces.dmx",
"typeUri": "dmx.workspaces.workspace",
"value": "DMX",
"children": {},
"assoc": {
"id": 4175,
"uri": "",
"typeUri": "dmx.workspaces.workspace_assignment",
"value": "",
"children": {},
"player1": {
"topicId": 4172,
"roleTypeUri": "dmx.core.parent"
},
"player2": {
"topicId": 1535,
"roleTypeUri": "dmx.core.child"
}
}
}}
},
"originalId": -1
}}
at systems.dmx.core.impl.ValueIntegrator.identityChildTopics(ValueIntegrator.java:391)
at systems.dmx.core.impl.ValueIntegrator.identifyParent(ValueIntegrator.java:344)
at systems.dmx.core.impl.ValueIntegrator.unifyComposite(ValueIntegrator.java:312)
at systems.dmx.core.impl.ValueIntegrator.integrateComposite(ValueIntegrator.java:259)
at systems.dmx.core.impl.ValueIntegrator.integrate(ValueIntegrator.java:103)
... 56 more
Caused by: java.lang.RuntimeException: Identity value "org.purl.classifications.system_id" is missing in [org.purl.classifications.system_name] (childTopic=null)
at systems.dmx.core.impl.ValueIntegrator.identityChildTopics(ValueIntegrator.java:379)
... 60 more
Okt 26, 2019 5:14:11 PM systems.dmx.core.impl.TransactionFactory$TransactionResourceFilter$2 filter
How i understand this is the following:
Currently only the first childType can be utilized as an "identity Attribute". If the typ-def has its identity attribute not on position 1 in the "compDefs" webclient topic creation will fail (as the user has no chance to provide any value for the second identityAttribute before creation).
Can you reproduce this?
Thanks for your support.