Skip to main content
grammar
Source Link
djq
  • 16.3k
  • 31
  • 112
  • 182

I'm developing an aplicationapplication where a I take a route from google maps, save it onin postgresql/postgis and i'd. I'd like to take this route (LineString geometry) and send it back to the GoogleMapsGoogle Maps.

I already gotcan save the map onin the database, now I want to show the routes on a map.

I tried to work with Jackson to transform the Entity to JSON, but, the Jackson fails to transform geometric data in json.

Someone Does anyone know how to transform this spatial data tointo JSON?

15:05:16,447 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sharecar].[default]] (http--0.0.0.0-8080-1) Servlet.service() for servlet default threw exception: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException$Reference from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader @1d332b (roots: /opt/demoiselle/server/jboss-7.1/modules)] ... at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:166) ... at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)

15:05:16,447 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sharecar].[default]] (http--0.0.0.0-8080-1) Servlet.service() for servlet default threw exception: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException$Reference from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader @1d332b (roots: /opt/demoiselle/server/jboss-7.1/modules)] ... at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:166) ... at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)

I'm developing an aplication where a I take a route from google maps, save it on postgresql/postgis and i'd like to take this route (LineString geometry) and send back to the GoogleMaps.

I already got save the map on database, now I want to show the routes on map.

I tried to work with Jackson to transform the Entity to JSON, but, the Jackson fails to transform geometric data in json.

Someone know how to transform this spatial data to JSON?

15:05:16,447 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sharecar].[default]] (http--0.0.0.0-8080-1) Servlet.service() for servlet default threw exception: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException$Reference from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader @1d332b (roots: /opt/demoiselle/server/jboss-7.1/modules)] ... at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:166) ... at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)

I'm developing an application where I take a route from google maps, save it in postgresql/postgis. I'd like to take this route (LineString geometry) and send it back to Google Maps.

I already can save the map in the database, now I want to show the routes on a map.

I tried to work with Jackson to transform the Entity to JSON, but, the Jackson fails to transform geometric data in json. Does anyone know how to transform this spatial data into JSON?

15:05:16,447 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sharecar].[default]] (http--0.0.0.0-8080-1) Servlet.service() for servlet default threw exception: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException$Reference from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader @1d332b (roots: /opt/demoiselle/server/jboss-7.1/modules)] ... at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:166) ... at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)

Source Link

Spatial Data from Postgis to Java/REST with RestEasy + Jackson

I'm developing an aplication where a I take a route from google maps, save it on postgresql/postgis and i'd like to take this route (LineString geometry) and send back to the GoogleMaps.

I already got save the map on database, now I want to show the routes on map.

On the client side I'm using JQuery (AJAX) + Google Maps Api. On the server side I'm using REST services with RestEasy.

I tried to work with Jackson to transform the Entity to JSON, but, the Jackson fails to transform geometric data in json.

Someone know how to transform this spatial data to JSON?

My Entity:

public class Rota {
...
private LineString caminho;
public Rota() {
}
public Rota(Integer id, Usuario usuario, String descricao, LineString     lineString) {
    this.id = id;
    this.usuario = usuario;
    this.descricao = descricao;
    this.caminho = lineString;
}
// getters and setters
@Type(type = "org.hibernate.spatial.GeometryType")
public LineString getCaminho() {
    return caminho;
}
public void setCaminho(LineString caminho) {
    this.caminho = caminho;
}
// hashcode and equals method
}

My REST service:

@Inject
private RotaBC rotaBC;

@GET
@Path("/rotas/{idrota}")
@Produces("application/json")
public Rota show(@PathParam("id") String id) {
    return rotaBC.show(Integer.parseInt(id));
} 

The error:

15:05:16,447 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sharecar].[default]] (http--0.0.0.0-8080-1) Servlet.service() for servlet default threw exception: java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException$Reference from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader @1d332b (roots: /opt/demoiselle/server/jboss-7.1/modules)] ... at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:166) ... at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112)