2016-11-30 1 views
0

가이드 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을 가져 오는 대신 요청이 실패했습니다.

누구나 여기에 아이디어가 있습니까? 고맙습니다.

답변

0

아직 라이센스를 얻지 못했지만 모든 ArcGIS 제품에 라이센스가 필요하며 비용 지불 여부는 중요하지 않습니다.

https://developers.arcgis.com/java/latest/guide/license-your-app.htm

// license with a license key 
ArcGISRuntimeEnvironment.setLicense("runtimelite,1000,rud#########,day-month-year,####################"); 
:

나는 친절하게 당신이는 ArcGIS 개발자 (JAVA 100.0.0에는 ArcGIS 런타임)이 "License your app"

당신이이 같은 라인이 필요하다고 볼 수 있습니다에서이 단계를 수행하는 것이 좋습니다

Maven Archetype의 Jersey HTTP 서버에서 ArcGIS 런타임을 사용하는 것에 대해 확신하지 못합니다. 추가 테스트가 필요하며 항상 서버 로그를 살펴보십시오.

0

Java 용 ArcGIS Runtime SDK는 서버 환경에서 사용할 API로 적합하지 않습니다. 일부 API가 작동하는 동안이 유스 케이스는 지원되지 않습니다. API는 서버 컨테이너에서 사용하도록 설계되지 않았습니다.

그러나 사용 사례에 대해 설명한 경우 여기에있는 Java Geometry API 오픈 소스 프로젝트를 참조하십시오. https://github.com/Esri/geometry-api-java.

그래도 현실을 말하면 서버 개발을위한 실행 가능한 솔루션이라고 생각하는 것이 자연 스럽다고 생각합니다. 그렇게 대단한 질문입니다!

관련 문제