Announcement Announcement Module
Collapse
No announcement yet.
SDN: Error when persisting to REST database (cross-store) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SDN: Error when persisting to REST database (cross-store)

    I'm getting an error when persisting an entity to the REST database. It happens when trying to create an index to the entity I'm storing.

    Code:
    java.lang.RuntimeException: Error adding element 73 foreignId com.domain.identity.Identity:18 to index Identity
    	org.neo4j.rest.graphdb.RestAPI.addToIndex(RestAPI.java:331)
    	org.neo4j.rest.graphdb.index.RestIndex.add(RestIndex.java:57)
    	org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityState.persistForeignId(CrossStoreNodeEntityState.java:102)
    	org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityState.createAndAssignState(CrossStoreNodeEntityState.java:69)
    	org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityState.persist(CrossStoreNodeEntityState.java:86)
    	org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityState.persist(CrossStoreNodeEntityState.java:1)
    	org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:273)
    	org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:132)
    	com.domain.identity.Identity.persist(Identity.java:1)
    The entity is persisted to JPA and flushed.

    There's no source for org.neo4j.rest.graphdb.RestAPI to step through on the debugger so I'm not sure what's causing the exception (and the message doesn't give any hints either). The API is getting the proper string to index. I don't see anything in the server log, but I'm not quite sure if there's a good way to bump up the logging to see if there's something on the server end I could see.

    Thanks.

    Edit: I am able to write to the index via REST through a PHP service.
    Last edited by andrewcelerity; Nov 21st, 2011, 10:22 AM.

  • #2
    The source for RestAPI is here: https://github.com/neo4j/java-rest-binding

    Can you also have a look at the servers' graph.db/messages.log ?

    Otherwise is it possible to extract the Test to a small sample project?

    Or at least provide the code snippets for your entity and the code that is calling the persist() ?

    Thanks a lot

    Comment


    • #3
      Here's what I get from the debugger as the status when it tries to post

      Code:
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
      <title>Error 405 Method Not Allowed</title>
      </head>
      <body><h2>HTTP ERROR 405</h2>
      <p>Problem accessing /db/data/index/node/Identity. Reason:
      <pre>    Method Not Allowed</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      <br/>                                                
      
      </body>
      </html>
      Does that tell you anything?

      Edit: btw, there was nothing odd in the messages.log file

      Comment


      • #4
        Here's some code snippets. They're pretty simple, I'm not doing anything out of the ordinary


        Model with extraneous JPA properties snipped out:
        Code:
        @Entity
        @Table(name="identity")
        @NodeEntity(partial=true)
        public class Identity {
        	@Id
        	@Column
        	@GeneratedValue(strategy=GenerationType.AUTO)
        	protected int id;
        	
        	/**
        	 * Name displayed on identity view
        	 */
        	@Column(length=80)
        	protected String displayName;
        	
        	/**
        	 * Copy of displayName for raw graph queries
        	 */
        	@GraphProperty
        	@Transient
        	String graphName;
        	
        	
        	@RelatedTo(elementClass=Identity.class, type="FRIENDS", direction=Direction.BOTH)
        	Set<Identity> friends;
        ...
        DAO, the persist method calls a parent persit method which is just a wrapper around entityManager.persist() (same thing with flush()). This is being called from a controller method that just instantiates a new Identity, sets a couple of values, they persists it.
        Code:
                public void persist(Identity entity) {
        		super.persist(entity);
        		this.flush();
        		entity.persist();
        	}

        Comment


        • #5
          It tells me that the way it tries to post to the index is (no longer) valid.

          What versions are you running:

          * neo4j server
          * spring data neo4j

          Thanks a lot

          Michael

          Comment


          • #6
            neo4j server: 1.5.M01
            spring data neo4j: 2.0 RC1

            edit: I am able to post to that index via PHP.
            Last edited by andrewcelerity; Nov 23rd, 2011, 09:50 AM.

            Comment


            • #7
              Could you update your server to 1.5.M02 and try it again? Or run it against a test server running 1.5.M02 or 1.5 ?

              Thanks a lot

              Michael

              Comment


              • #8
                I got 1.5 GA and that worked. Strange.

                Thanks for your help.

                Comment

                Working...
                X