반응형

chatGPT로 생성한 이미지

나는 현재 Neo4j라는 그래프 데이터베이스에서 공간정보를 다루는 연구를 하고 있다. 이 과정에서 원래 Neo4j에서 지원하지 않았던 다양한 공간연산을 프로시저 형태로 구현하는 작업을 하였고, 현재는 길 찾기 알고리즘을 프로시저 형태로 개선 및 구현하는 작업을 하고 있다.

 

이 과정에서 나의 실수에서 비롯된 의문의 오류를 해결하는 과정을 나누고자 글을 작성해본다.

 

@Procedure(name = "gspatial.shortestPath.oneToMany", mode = READ)
@Description("Calculates shortest paths from a single start POI to multiple target POIs that satisfy a cost threshold")
public Stream<PathFindingUtility> oneToManyShortestPath(
        @Name("startNode") Node startNode,
        @Name("targetPOILabel") String targetPOILabel,
        @Name("networkLabel") String networkLabel,
        @Name(value = "cost", defaultValue = "") String costProperty,
        @Name("threshold") Double threshold

 

위와 같은 형태의 프로시저를 개발하고자 했을 때, 오류가 발생하였다. Maven 빌드는 잘 되었으나, 빌드된 JAR 파일을 Neo4j Plugins 폴더에 넣고 Neo4j를 실행하고자 할 때, 오류가 발생했다. 각종 Log들을 살펴보아도, 어떤 이유에서 오류가 발생하였는지 알기 어려웠다.

 

그러나 원인은 아주 간단하였다.

 

@Name(value = "cost", defaultValue = "") String costProperty,
@Name("threshold") Double threshold

->
@Name("threshold") Double threshold
@Name(value = "cost", defaultValue = "") String costProperty,

Default 값이 있는 cost 라는 파라미터가 필수 입력 파라미터인 threshold보다 먼저 작성하게 설계하였기 때문에 발생한 문제였다. 그래서 그 순서를 바꾸어주니 해결되었다.

 

부끄러울 정도로 사소한 실수였으나, 초보적인 실수여서 그런지 인터넷에 정보도 많이 없었던 만큼 누군가에게 도움이 되지 않을까 싶어서 남겨본다.

반응형

+ Recent posts