가이드 here을 따라 Maven Archetype에서 새 Jersey HTTP 서버를 만들었습니다. 모든 것이 여기에, 자원이 예상대로 문자열을 반환, 괜찮 자원이다Java 용 ArcGIS Runtime SDK를 통합 할 때 Grizzly HTTP Server (저지)에 오류가 발생했습니다
package com.example;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("myresource")
public class MyResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getIt() {
return "Hello from my Server";
}
}
나는 다운로드는 ArcGIS 런타임 SDK를 사용하도록 가이드 here을 따랐다. 나는 결정하기 위해 다음과 같은 간단한 자바 클래스를 생성 여부를 기하학의 내부에 점 (원형, 사각형, 다각형, ...) 여부 :
package geoC;
import com.esri.arcgisruntime.geometry.Geometry;
import com.esri.arcgisruntime.geometry.GeometryEngine;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.SpatialReferences;
public class checkInside {
public static void main(String[] args) {
Point pt = new Point(-0.04473405456542423, 39.98776978688296, SpatialReferences.getWgs84());
String rectangleJson = "{\"xmin\":-0.05225854142896743,\"ymin\":39.98251082423102,\"xmax\":-0.02856927140946811,\"ymax\":39.993164240959295,\"spatialReference\":{\"wkid\":4326}}";
Geometry rectangle = (Geometry) Geometry.fromJson(rectangleJson);
//check if the point is inside the rectangle or not
boolean decision = GeometryEngine.contains(rectangle, pt);
System.out.println(decision);
}
}
이 클래스는 생산, 잘 작동 "true"또는 "false" 위치 입력에 따라
문제는 내가 첫 번째와 두 번째 코드 조각을 결합하려고 할 때, 나는 코드의 첫 번째 부분에서 코드의 두 번째 작품의 내용을 넣어 발생 :
package com.example;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.esri.arcgisruntime.geometry.Geometry;
import com.esri.arcgisruntime.geometry.GeometryEngine;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.SpatialReferences;
@Path("myresource")
public class MyResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getIt() {
Point pt = new Point(-0.04473405456542423, 39.98776978688296, SpatialReferences.getWgs84());
String rectangleJson = "{\"xmin\":-0.05225854142896743,\"ymin\":39.98251082423102,\"xmax\":-0.02856927140946811,\"ymax\":39.993164240959295,\"spatialReference\":{\"wkid\":4326}}";
Geometry rectangle = (Geometry) Geometry.fromJson(rectangleJson);
boolean decision = GeometryEngine.contains(rectangle, pt);
System.out.println(decision);
return "Hello from my Server";
}
}
MVN 컴파일 --- 자바 ---> 빌드 실패
오류입니다 : 간부-받는다는 - 플러그인 : 1.2.1 : 목표 org.codehaus.mojo을 실행하지 못했습니다 자바 (기본-CLI>
MVN 간부 성공 BUILD) on TestArcGISJersey : Java 클래스를 실행하는 동안 예외가 발생했습니다. null : InvocationTargetException : com/esri/arcgisruntime/geometry/Geometry : com.esri.arcgisruntime.geometry.Geometry -> [Help 1]
또한 2 행을 주석 처리하면 (부울 결정 = ... + 시스템 .out.println (...)) 그런 다음 mvn exec : java가 성공적으로 실행되지만 리소스에 GET 요청을 보낼 때 예상되는 String을 가져 오는 대신 요청이 실패했습니다.
누구나 여기에 아이디어가 있습니까? 고맙습니다.