Announcement Announcement Module
Collapse
No announcement yet.
Error with Neo4J @Indexed property Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error with Neo4J @Indexed property

    Please try my JUnit tests at https://github.com/killersite/Neo4JSpatialTests

    When I try to use neo4j-spatial with a @NodeEntity(partial=true) I always get NPE of the following kind.

    Code:
    java.lang.NullPointerException
    	at org.neo4j.gis.spatial.pipes.GeoPipeline.startNearestNeighborLatLonSearch(GeoPipeline.java:363)
    	at org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.query(LayerNodeIndex.java:249)
    and the SpatialRepository interface Repositories don't work either...

    Code:
    java.lang.NullPointerException
    	at com.ex.domain.Restaurant_Roo_JavaBean.ajc$interMethodDispatch1$com_ex_domain_Restaurant_Roo_JavaBean$com_ex_domain_Restaurant$getName(Restaurant_Roo_JavaBean.aj)
    	at com.ex.graph.RestaurantSpatialTest.testFindByName(RestaurantSpatialTest.java:59)
    I am having a hard time understanding why my tests are failing. If you could take a look at them and let me know what I am doing wrong I would appreciate it.

    Thanks,
    Ben

  • #2
    Help.

    Anyone try the Neo4J unit test in https://github.com/killersite/Neo4JSpatialTests ?

    cross-store entities are causing NPE errors with the following tests.

    Code:
    @Test
    	public void testFindWithinDistance() {
        	Iterable<Restaurant> venus = restaurantService.findWithinDistance(16,56,70);
            assertThat(asCollection(venus), hasItems(restaurant));
    	}
    
    	@Test
    	public void testFindByName() {
    		Restaurant foundvenu = restaurantService.findByName("test");
    		assertEquals("test", foundvenu.getName());
    	}
    Thanks,
    Ben

    Comment


    • #3
      Ben,

      I had a look. I don't think it is cross-store stuff that is the problem. Instead, here are a couple of changes that move the tests into green (some other tests are red for me though, due to Roo/ AspectJ stuff):

      Code:
      In RestaurantServiceImpl:
      public void saveRestaurant(Restaurant restaurant) {
              restaurantNeoRepository.save(restaurant);
      //        restaurant.persist();
          }
      
      In RestaurantSpatialTest-context.xml:
      <neo4j:config storeDirectory="target/servicetest"/>
      
      In VenueSpatialTest-context.xml:
      <bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase" destroy-method="shutdown"/>
      <neo4j:config storeDirectory="target/venuetest"/>
      Hope that helps!

      Regards,

      Lasse

      Comment


      • #4
        Originally posted by lassewesth View Post
        Ben,

        I had a look. I don't think it is cross-store stuff that is the problem. Instead, here are a couple of changes that move the tests into green (some other tests are red for me though, due to Roo/ AspectJ stuff):
        Thanks for the response Lasse.

        Except you're proving my point that cross-store is the problem. In order to save the Entity in the SQL database I have to use -

        Code:
        <neo4j:config graphDatabaseService="graphDatabaseService" entityManagerFactory="entityManagerFactory"/>
        without the entityManagerFactory attribute it is straight Neo4J. Right?

        Also VenueSpatialTest.java should be "green" without any changes. That is there to demonstrate what you showed with the changes to RestaurantSpatialTest.java - without an entityManagerFactory the test passes fine.

        Please help. Thanks.
        -Ben

        Comment


        • #5
          HELP - Can anyone make my Neo4j-spatial junit tests pass against cross-store Entities?
          https://github.com/killersite/Neo4JS...atialTest.java

          Do you have a simple JUnit test showing the findWithinDistance method working against cross-store Entities?

          Comment

          Working...
          X