我是关于在stackoverflow上发布答案的新手 . 我希望你能帮助我 .

我正在使用Google Map 开发Android应用 . 它通过HTTP REST调用JBOSS 7服务器,该服务器通过HTTP REST调用另一台服务器从某些Open Data获取一些点 . 然后,当第一台服务器获得响应时,它必须为智能手机客户端准备数据 . 因此,它使用GeoPoint准备OverlayItem的数组列表 . 但是在创建GeoPoint时有一个例外 .

我在/ WebContent / WEB-INF / lib /中放了maps.jar和gson-2.2.2.jar,看起来它有效,但我对Java和JBoss并不那么专业,也不知道它是否正确 .

这是JBoss控制台中的例外:

11:36:23,287 ERROR [org.apache.catalina.core.ContainerBase . [jboss.web] . [default-host] . [/ Prototipo_server_2] . [it.unifi.sistemiTelematici.BikeServer.Rest.BikeServerREST]]( http - 0.0.0.0-8080-1)Servlet的Servlet.service()it.unifi.sistemiTelematici.BikeServer.Rest.BikeServerREST抛出异常:org.jboss.resteasy.spi.UnhandledException:java.lang.RuntimeException:stub at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340)[resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214 )[orte.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)的[resteasy-jaxrs-2.3.2.Final.jar:] org中的[resteasy-jaxrs-2.3.2.Final.jar:] .jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540)[resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:] org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)[resteasy-jaxrs-2.3.2.Final.jar:] at org . jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)[resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service (HttpServletDispatcher.java:55)[resteasy-jaxrs-2.3.2.Final.jar:] org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)[resteasy-jaxrs-2.3 .2.Final.jar:]在org的javax.servlet.http.HttpServlet.service(HttpServlet.java:847)[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] .apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)[jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)[jbossweb -7.0.13.Final.jar:] at org.apache.catalina.core.StandardWra pperValve.invoke(StandardWrapperValve.java:275)[jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)[jbossweb-7.0.13.Final . jar:] org.apache中的org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)[jboss-as-web-7.1.1.Final.jar:7.1.1.Final] . catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)[jbossweb-7.0.13.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[jbossweb-7.0 . 13.Final.jar:] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[jbossweb-7.0.13.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:368)[jbossweb-7.0.13.Final.jar:] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)[jbossweb-7.0.13.Final.jar:]在org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process(Http11Protocol.java:671)[jbos在java.lang上的org.apache.tomcat.util.net.JIoEndpoint $ Worker.run(JIoEndpoint.java:930)[jbossweb-7.0.13.Final.jar:]的sweb-7.0.13.Final.jar:] .Thread.run(Unknown Source)[rt.jar:1.7.0_09]引起:java.lang.RuntimeException:存在com.google.android.maps.GeoPoint . (未知来源)[maps.jar:]在它.unifi.sistemiTelematici.BikeServer.Rest.ServiziRastrelliere.getRastrelliereList(ServiziRastrelliere.java:100)[classes:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[rt.jar:1.7.0_09] at sun.reflect.NativeMethodAccessorImpl .invoke(未知来源)[rt.jar:1.7.0_09] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)[rt.jar:1.7.0_09] at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_09] atorg.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)[resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) )[orte.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)[resteasy-jaxrs-2.3.2.Final.jar:] org的[resteasy-jaxrs-2.3.2.Final.jar:] .jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)[resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:] ......还有19个

这是给出异常的类的代码:

package it.unifi.sistemiTelematici.BikeServer.Rest;

import it.unifi.sistemiTelematici.BikeServer.JSON.JSONArray;
import it.unifi.sistemiTelematici.BikeServer.JSON.JSONException;
import it.unifi.sistemiTelematici.BikeServer.JSON.JSONObject;
import it.unifi.sistemiTelematici.BikeServer.Utils.CoordinatesUtilities;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;

@Path("/ServiziRastrelliere")
public class ServiziRastrelliere {

    private RestComuneFirenze restComune;
    private CoordinatesUtilities CoordinatesUtilities;

    public ServiziRastrelliere() {

        restComune = new RestComuneFirenze();
        CoordinatesUtilities = new CoordinatesUtilities();

    }

    JSONArray rastrelliereFeatures = null;


    @GET
    @Produces("application/json")
    @Path("/RastrelliereList/{latitudine}/{longitudine}")
    public String getRastrelliereList(@PathParam("latitudine") String latitudine, @PathParam("longitudine") String longitudine){

        String rastrelliereListJSON = null;

        JSONObject rastrellieraObj, rastrellieraGeometryObj, rastrellieraPropertiesObj;
        JSONArray rastrellieraCoordinates;
        double rastrellieraCoordX, rastrellieraCoordY;
        int rastrellieraCoordXint, rastrellieraCoordYint;
        String rastrellieraPostiString, rastrellieraLocalizzazione, rastrellieraModello;

        List<OverlayItem> myOverlayItemList = new ArrayList<OverlayItem>();
        Type listOfMyOverlayItemType = new TypeToken<List<OverlayItem>>(){}.getType();

        rastrelliereFeatures = restComune.getRastrelliereList(latitudine, longitudine);

        if (rastrelliereFeatures != null) {

            try {

                for (int i = 0; i < rastrelliereFeatures.length(); i ++) {

                    rastrellieraObj = rastrelliereFeatures.getJSONObject(i);
                    rastrellieraGeometryObj = rastrellieraObj.getJSONObject("geometry");

                    rastrellieraCoordinates = rastrellieraGeometryObj.getJSONArray("coordinates");
                    rastrellieraCoordX = rastrellieraCoordinates.getDouble(0);
                    rastrellieraCoordY = rastrellieraCoordinates.getDouble(1);
                    rastrellieraCoordXint = CoordinatesUtilities.fromJSONtoItemCoord(rastrellieraCoordX);
                    rastrellieraCoordYint = CoordinatesUtilities.fromJSONtoItemCoord(rastrellieraCoordY);

                    rastrellieraPropertiesObj = rastrellieraObj.getJSONObject("properties");

                    rastrellieraPostiString = rastrellieraPropertiesObj.get("NUMPOSTI").toString();
                    rastrellieraLocalizzazione = rastrellieraPropertiesObj.getString("LOCALIZZAZIONE");
                    rastrellieraModello = rastrellieraPropertiesObj.getString("MODELLO");

                    //myOverlayItemList.add(new OverlayItem(new GeoPoint(rastrellieraCoordYint, rastrellieraCoordXint), rastrellieraLocalizzazione, "Modello = " + rastrellieraModello + "Posti: " + rastrellieraPostiString));

                    System.out.println("rastrellieraCoordYint = " + rastrellieraCoordYint + " rastrellieraCoordXint = " + rastrellieraCoordXint);

                    //myOverlayItemList.add(new OverlayItem(new GeoPoint(rastrellieraCoordYint, rastrellieraCoordXint), "a", "b"));

                    GeoPoint geopoint = new GeoPoint(43770262, 11252829);

                    //myOverlayItemList.add(new OverlayItem( new GeoPoint(43770262, 11252829), "Access Title 1", "Access snippet 1"));

                }

            } catch (JSONException ex) {

                ex.printStackTrace();

            } 

            Gson gson = new Gson();
            rastrelliereListJSON = gson.toJson(myOverlayItemList, listOfMyOverlayItemType);

        } else {

            rastrelliereListJSON = "error";

        }

        return rastrelliereListJSON;

    }


}