Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

the example provided don't work, errorinfo: Vertex does not support user supplied identifiers #231

Closed
jiangfeng opened this issue Jul 3, 2019 · 23 comments

Comments

@jiangfeng
Copy link

Your issue may already be reported! Please search before creating a new one.

Expected Behavior

examples run successfully

Current Behavior

raise a exeception:
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex does not support user supplied identifiers

11253624 [gremlin-server-exec-4] WARN org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=63a49f3d-3d52-438f-8f5c-babc487f70db, op='eval', processor='', args={gremlin=g.addV('Person').property(id, '1').property('name', '56').property('_classname', 'com.finsight.kgcp.examples.janusgraph.entity.Person').property('age', 'LH'), batchSize=64}}].
java.lang.UnsupportedOperationException: Vertex does not support user supplied identifiers
at org.apache.tinkerpop.gremlin.structure.Vertex$Exceptions.userSuppliedIdsNotSupported(Vertex.java:163)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsTransaction.addVertex(JanusGraphBlueprintsTransaction.java:105)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.addVertex(JanusGraphBlueprintsGraph.java:140)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.addVertex(JanusGraphBlueprintsGraph.java:59)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep.processNextStart(AddVertexStartStep.java:91)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:192)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:89)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:252)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:274)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Your Environment

  • Version used: Gremlin / Janusgraph0.3.2
  • Operating System and version (desktop or mobile): Mac
  • SDK version: JDK1.8
@Incarnation-p-lee
Copy link
Contributor

Thanks for issue this, could you please provide more information about this ? like spring boot version, spring data gremlin version, as well as minimal code to reproduce ?

@clunny-slb
Copy link

I am getting the same issue with an OrientDB gremlin server on Mac. To reproduce:

  1. Download OrientDB server with Gremlin from https://s3.us-east-2.amazonaws.com/orientdb3/releases/3.0.22/orientdb-tp3-3.0.22.tar.gz
  2. Run the OrientDB server with Gremlin server from bin/server.sh and set the root password
  3. Set the credentials, host and port in application.yaml (in test/resources)
  4. Run the tests mvn test
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.072 s <<< FAILURE! - in example.springdata.gremlin.GremlinRepositoryIntegrationTest
[ERROR] testRepository(example.springdata.gremlin.GremlinRepositoryIntegrationTest)  Time elapsed: 7.052 s  <<< ERROR!
com.microsoft.spring.data.gremlin.exception.GremlinQueryException: unable to complete query from gremlin; nested exception is java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex does not support user supplied identifiers
Caused by: java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex does not support user supplied identifiers
Caused by: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex does not support user supplied identifiers

@Incarnation-p-lee
Copy link
Contributor

Can u reproduce this behavior with Gremlin server ?

@clunny-slb
Copy link

clunny-slb commented Jul 20, 2019

Yes. The orientdb-tp3-* release contains a gremlin server (which is what I tested above). I also tried it from the standalone gremlin-server 3.4.2 downloaded from https://tinkerpop.apache.org/ and I get exactly the same error.

I just tested the gremlin server using the neo4j backend and it also has the same issue.

To reproduce it with Neo4J:

  1. Download and unzip gremlin-server 3.4.2 from https://tinkerpop.apache.org/
  2. Install Neo4J plugin to gremlin-server. While in gremlin-server directory: ./bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin 3.4.2
  3. Start gremlin-server with Neo4J: ./bin/gremlin-server.sh conf/gremlin-server-neo4j.yaml

In the spring-data-gremlin example directory:

  1. Set the host=localhost and port=8182 in application.yaml (in src/test/resources)
  2. Run the tests mvn test
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 5.529 s <<< FAILURE! - in example.springdata.gremlin.GremlinRepositoryIntegrationTest
[ERROR] testRepository(example.springdata.gremlin.GremlinRepositoryIntegrationTest)  Time elapsed: 1.286 s  <<< ERROR!
com.microsoft.spring.data.gremlin.exception.GremlinQueryException: unable to complete query from gremlin; nested exception is java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex does not support user supplied identifiers
        at example.springdata.gremlin.GremlinRepositoryIntegrationTest.testRepository(GremlinRepositoryIntegrationTest.java:85)
Caused by: java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex does not support user supplied identifiers
        at example.springdata.gremlin.GremlinRepositoryIntegrationTest.testRepository(GremlinRepositoryIntegrationTest.java:85)
Caused by: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Vertex does not support user supplied identifiers

I just noticed that this seems to be similar: #142

@Incarnation-p-lee
Copy link
Contributor

gremlin server version greater than 3.3.4 has breaking change, it is known issue here. Could you please help to try this version ?

@clunny-slb
Copy link

clunny-slb commented Jul 20, 2019

I just tried with gremlin-server version 3.3.4 using neo4j-gremlin 3.3.4 plugin and I get the exact same error.

I get the same error with versions 3.3.3 also.

@saragluna
Copy link
Collaborator

  • For the NEO4J and OrientDB case User Supplied Id is not supported so the sample would fail for these two. As shown by the source code:

  • As to JanusGraph could set graph.set-vertex-id = true in the server config file.

@clunny-slb
Copy link

Does that mean that this project doesn't support Neo4J and OrientDB or is there a workaround?

@stozk
Copy link

stozk commented Aug 4, 2019

Any news on this?
I have the same problem when trying the latest orientDB-TP3 with this.

When I don't set the IDs manually and leave it to Spring I get another error:

java.lang.IllegalArgumentException: should contain a type property

@saragluna
Copy link
Collaborator

@stozk Thanks for reaching out to us. Could you please provide more information about this? Like version, stacktrace or minimal code to reproduce it?

@stozk
Copy link

stozk commented Aug 4, 2019

I'm using

  • Windows 10 x64
  • JDK 8.0.211
  • Spring Boot 2.1.6.RELEASE
  • orientdb-tp3-3.0.22 (embedded Gremlin 3.3.0)
  • spring-data-gremlin 2.1.2

The Vertex entities are modeled simple with one AAS relation to one SmartService with an AssetRelation Edge. As mentioned I have removed the ID argument from the constructor and left the assignment of IDs to Spring. Providing an ID manually resulted in "Vertex does not support user supplied identifiers" as mentioned by the OP.

        metaDataRepo.deleteAll();
        Random rnd = new Random();
        int n = 100000 + rnd.nextInt(900000);
        Aas aas = new Aas("AAS_"+n);  

        MetaDataGraph mdg = new MetaDataGraph();

        mdg.getVertexes().add(aas);

        metaDataRepo.save(mdg);
@Vertex
public class Aas {

    public Aas(String name) {
        this.name = name;
    }

    @Id
    (@GeneratedValue doesn't make a difference)
    private String id;

    private String name;

 ..getters/setters…

}

When I trigger the code this comes up:

2019-08-04 14:41:49.902 INFO 12476 --- [nio-8008-exec-1] o.a.tinkerpop.gremlin.driver.Connection : Created new connection for ws://localhost:8182/gremlin
2019-08-04 14:41:49.909 INFO 12476 --- [nio-8008-exec-1] o.a.tinkerpop.gremlin.driver.Connection : Created new connection for ws://localhost:8182/gremlin
2019-08-04 14:41:49.910 INFO 12476 --- [nio-8008-exec-1] o.a.t.gremlin.driver.ConnectionPool : Opening connection pool on Host{address=localhost/127.0.0.1:8182, hostUri=ws://localhost:8182/gremlin} with core size of 2
2019-08-04 14:41:50.237 ERROR 12476 --- [nio-8008-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: should contain a type property] with root cause
java.lang.IllegalArgumentException: should contain a type property
at org.springframework.util.Assert.isTrue(Assert.java:118)
at com.microsoft.spring.data.gremlin.conversion.result.GremlinResultsGraphReader.processResult(GremlinResultsGraphReader.java:55) ....

When I actually try to create a Graph with connected Vertexes I get this exact problem as stated here:

#142 (comment)

2019-08-04 22:15:38.061 ERROR 1860 --- [nio-8008-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.microsoft.spring.data.gremlin.exception.GremlinInvalidEntityIdFieldException: The vertex id for the from vertex cannot be null!] with root cause

metaDataRepo.deleteAll();

        Random rnd = new Random();
        int n = 100000 + rnd.nextInt(900000);
        String uuid = UUID.randomUUID().toString();
        Aas aas = new Aas("AAS_"+n);

        Random rnd2 = new Random();
        int n2 = 100000 + rnd2.nextInt(900000);
        String uuid2 = UUID.randomUUID().toString();
        SmartService smartService = new SmartService(uuid2,"SmartService_"+n2);

        Random rnd3 = new Random();
        int n3 = 100000 + rnd3.nextInt(900000);
        String uuid3 = UUID.randomUUID().toString();

        AssetRelation assetRelation = new AssetRelation("AssetRelation"+n3, aas, smartService);

        MetaDataGraph mdg = new MetaDataGraph();

        mdg.getEdges().add(assetRelation);
        mdg.getVertexes().add(aas);
        mdg.getVertexes().add(smartService);
        
        metaDataRepo.save(mdg);

@saragluna
Copy link
Collaborator

@stozk

  1. I think this error should contain a type property could be caused by a mismatch of serializer. Could you please provide a snippet of your gremlin-server config file addressing the serializers part?
  2. Since the vertex's id is auto-generated so I think the edge can not associate with the vertex's id. That could be the reason of The vertex id for the from vertex cannot be null.

@stozk
Copy link

stozk commented Aug 5, 2019

Yeah, number 2 is quite clearly caused by an id not being automatically generated respectively assigned.

Here's the serializer settings from the gremlin-server.yml

serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }}             # application/vnd.gremlin-v3.0+gryo
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}                                                                       # application/vnd.gremlin-v3.0+gryo-stringd
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }}         # application/json

I have no idea what I'm doing, so I just tried different variants from here:
https://github.com/apache/tinkerpop/tree/master/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser

Same outcome, when I comment it out completely the standard fallback is GraphSONMessageSerializerV2d0.

Could the problem be that orientDB doesn't use Strings as IDs but ORID Objects?
https://orientdb.com/javadoc/latest/com/orientechnologies/orient/core/id/ORID.html

@saragluna
Copy link
Collaborator

@stozk

  1. Have you tried to substitute the GraphSONMessageSerializerV3d0 with GraphSONMessageSerializerV1d0 ? You can check the GraphSON DOC here.
  2. Yes, you're right about the Vertex's ID. It's a known issue when you save the graph with edges and vertices , and choose to use @GeneratedValue for vertex's ID the program fails to associate the Vertex's ID with edge.

@stozk
Copy link

stozk commented Aug 6, 2019

Yes, I've tried to change it, same result.

So is it even possible to use this library with orienDB?
Shouldn't this work with any Gremlin/TP3 implementation which adhers to the standard?

@saragluna
Copy link
Collaborator

@stozk I haven't tried the OrientDB yet. But this project does work with any Gremlin-compatible data store.

@stozk
Copy link

stozk commented Aug 6, 2019

I have now changed the serializer to this in the gremlin-server.yaml:

 - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }}             # application/vnd.gremlin-v3.0+gryo
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: false }}                                                                       # application/vnd.gremlin-v3.0+gryo-stringd
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }}         # application/json         # application/json

Now I get a new error ;-)

2019-08-06 16:12:17.488 ERROR 11692 --- [n-driver-loop-1] o.a.t.g.d.Handler$GremlinResponseHandler : Could not process the response
io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: org.apache.tinkerpop.shaded.kryo.KryoException: Encountered unregistered class ID: 65536
Serialization trace:
id (org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex)

I have found this on stackoverflow regarding a similar error, but with Janusgraph instead of orientDB:

https://stackoverflow.com/questions/53202745/janusgraph-0-3-0-tinkerpop-3-3-3-java-serialization-error-after-adding-edge-us

They resolved the error by registering the JanusGraphIoRegistry on the client side:

GryoMapper.Builder builder = GryoMapper.build().
                                        addRegistry(JanusGraphIoRegistry.getInstance());

GryoMessageSerializerV3d0 serializer = new GryoMessageSerializerV3d0(builder);
Cluster cluster = Cluster.build().
                          addContactPoint(host).
                          port(port).
                          serializer(serializer).
                          create();

In my case I guess I would have to register the org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry on my client side?

But the GremlinConfig build only takes in the serializer String. Is it possible to configure it with the OrientIoRegistry too?

@stozk
Copy link

stozk commented Aug 9, 2019

I've found another similar example, which has also been resolved by adding the registry to the serializer config on the client side.

orientechnologies/orientdb-gremlin#161 (comment)

GryoMessageSerializerV3d0 serializer = new GryoMessageSerializerV3d0(
        GryoMapper.build().addRegistry(OrientIoRegistry.instance()));

Cluster c = Cluster.build("localhost").port(8182).credentials("root", "root")
        .serializer(serializer).create();

So it's generally possible, but how would you do it with this libray?

@Tin-Nguyen
Copy link

hi all,

I got the same issue with Spring-Data-Gremlin working with my JanusGraph (docker). I'm using both with latest version. Anyone have ever resolved the issue yet?

@hhhyang
Copy link

hhhyang commented Sep 20, 2019

hi all,

I got the same issue with Spring-Data-Gremlin working with my JanusGraph (docker). I'm using both with latest version. Anyone have ever resolved the issue yet?
========================

I got the same issue while running the provided example with command:
$ mvn spring-boot:run

my JanusGraph version is 0.4.0

Is there some good news?

@clunny-slb
Copy link

clunny-slb commented Sep 20, 2019

I've come to the conclusion that this project does not work with any gremlin-compatible data source (as it claims). The provided example does not work with OrientDB nor Neo4J exposed via Tinkerpop servers (see my previous posts in this issue). Has anybody tested that it works with OrientDB or Neo4J? If this project doesn't work with these databases then that should be stated in the documentation somewhere close to the claim that it works with any gremlin-compatible data source so that people are not mislead.

@joaomenighin-hotmart
Copy link

Had the same issues trying it out with Amazon Neptune.
Cannot query or insert anything :/

@chenrujun
Copy link

Closing this issue.
Because it's not active for a long time.
If anyone have similar issue, please create issue in new repo: https://github.com/Azure/azure-sdk-for-java/issues

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants