3
我正在使用PostgreSQL DB + PostGIS上的Spring + Hibernate,它具有Geometry
,它對數據庫執行CRUD操作並使用Jackson JSON視圖返回JSON輸出。它工作正常,直到我加入Geometry
。當我檢查對象時,搜索返回正確的輸出,但是在創建具有Geometry
的結果的JSON表示時似乎存在問題。我得到這樣的東西:傑克遜與幾何的JSON視圖
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: This method does not support GeometryCollection arguments (through reference chain: java.util.ArrayList[0]->com.tutorial.jquery.model.State["geom"]->com.vividsolutions.jts.geom.MultiPolygon["boundary"]->com.vividsolutions.jts.geom.MultiLineString["boundary"]->com.vividsolutions.jts.geom.MultiPoint["boundary"]->com.vividsolutions.jts.geom.GeometryCollection["boundary"]); nested exception is org.codehaus.jackson.map.JsonMappingException: This method does not support GeometryCollection arguments (through reference chain: java.util.ArrayList[0]->com.tutorial.jquery.model.State["geom"]->com.vividsolutions.jts.geom.MultiPolygon["boundary"]->com.vividsolutions.jts.geom.MultiLineString["boundary"]->com.vividsolutions.jts.geom.MultiPoint["boundary"]->com.vividsolutions.jts.geom.GeometryCollection["boundary"])
at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.writeInternal(MappingJacksonHttpMessageConverter.java:195)
at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:179)
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:148)
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:90)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:189)
at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:69)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:122)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:746)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.codehaus.jackson.map.JsonMappingException: This method does not support GeometryCollection arguments (through reference chain: java.util.ArrayList[0]->com.tutorial.jquery.model.State["geom"]->com.vividsolutions.jts.geom.MultiPolygon["boundary"]->com.vividsolutions.jts.geom.MultiLineString["boundary"]->com.vividsolutions.jts.geom.MultiPoint["boundary"]->com.vividsolutions.jts.geom.GeometryCollection["boundary"])
at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:215)
at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:180)
at org.codehaus.jackson.map.ser.SerializerBase.wrapAndThrow(SerializerBase.java:128)
任何人都可以提出一些建議嗎?