Is your Pair serializable, i.e. a POJO?
Otherwise you can just create a Map or List of Map of Lists.

Michael

> Am 24.03.2015 um 10:23 schrieb Constantin Mitocaru <[email protected]>:
> 
> 
> I have not found a solid solution on stackoverflow nor here yet.
> I developed a Server plugin and installed it on neo4j server.
> The rest works fine if it returns primitives.
> However when it gets to this method:
> 
>       
>       @GET
>       @Path("/dum")
>       @Produces({MediaType.APPLICATION_JSON})
>       public RestResponse<Pair<String,String>> dumDum() {
>               return RestResponse.success("Ok", Pair.of("dum", "dum"));
>       }
> 
> 
> 
> 
> throws this error
> 
> 
> SEVERE: A message body writer for Java class com.mycomp.rest.RestResponse, 
> and Java type 
> com.mycomp.rest.RestResponse<com.mycomp.commons.Pair<java.lang.String, 
> java.lang.String>>, and MIME media type application/json was not found
> Mar 24, 2015 11:19:41 AM com.sun.jersey.spi.container.ContainerResponse write
> SEVERE: The registered message body writers compatible with the MIME media 
> type are:
> */* ->
>   com.sun.jersey.core.impl.provider.entity.FormProvider
>   com.sun.jersey.core.impl.provider.entity.StringProvider
>   com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
>   com.sun.jersey.core.impl.provider.entity.FileProvider
>   com.sun.jersey.core.impl.provider.entity.InputStreamProvider
>   com.sun.jersey.core.impl.provider.entity.DataSourceProvider
>   com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
>   com.sun.jersey.core.impl.provider.entity.ReaderProvider
>   com.sun.jersey.core.impl.provider.entity.DocumentProvider
>   com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
>   com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
>   com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
>   com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
>   com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
> 
> Mar 24, 2015 11:19:41 AM com.sun.jersey.spi.container.ContainerResponse 
> logException
> SEVERE: Mapped exception to response: 500 (Internal Server Error)
> javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A 
> message body writer for Java class com.mycomp.rest.RestResponse, and Java 
> type com.mycomp.rest.RestResponse<com.mycomp.commons.Pair<java.lang.String, 
> java.lang.String>>, and MIME media type application/json was not found
>       at 
> com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
>       at 
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
>       at 
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
>       at 
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
>       at 
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
>       at 
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
>       at 
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>       at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
>       at 
> org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>       at org.eclipse.jetty.server.Server.handle(Server.java:445)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268)
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
>       at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: com.sun.jersey.api.MessageException: A message body writer for 
> Java class com.mycomp.rest.RestResponse, and Java type 
> com.mycomp.rest.RestResponse<com.mycomp.commons.Pair<java.lang.String, 
> java.lang.String>>, and MIME media type application/json was not found
>       ... 25 more
> 
> 
> 
> One solution i found was to use genson. It works BUT it breaks the 
> functionality of the regular neo4j endpoint db/data/. So the genson solution 
> ain't gonna fly.
> Under a normal web app I would add this in web.xml
> 
>               <init-param>
>                       
> <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
>                       <param-value>true</param-value>
>               </init-param>
> 
> 
> 
> But here I do NOT have a web.xml to alter.
> 
> Please let me know my options
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to