What's available in Unmanaged Extensions?

127 views
Skip to first unread message

Nicholas Stuart

unread,
Aug 9, 2012, 6:10:03 PM8/9/12
to ne...@googlegroups.com
I'm following the guide  http://docs.neo4j.org/chunked/milestone/server-unmanaged-extensions.html to create my own unmanaged extension, but I noticed that is says I can get a Logger, but I tried to get it through the Context and was unable to. What's available from the @Context?


Michael Hunger

unread,
Aug 9, 2012, 6:15:54 PM8/9/12
to ne...@googlegroups.com
you can use a java.util.logging logger there.

If that's ok with you?

Michael

Nicholas Stuart

unread,
Aug 9, 2012, 10:04:30 PM8/9/12
to ne...@googlegroups.com
I attempted to do this, using @Context Logger logger in my constructor but got an error when I tried to deploy to 1.8 M06.

Michael Hunger

unread,
Aug 9, 2012, 10:09:42 PM8/9/12
to ne...@googlegroups.com
Just the usual 

Logger logger = Logger.getLogger(MyClasss.class.getName());

Nicholas Stuart

unread,
Aug 13, 2012, 5:07:41 PM8/13/12
to ne...@googlegroups.com
Thanks Michael. What else is available though? I'm trying to return a a Collection Class through a JSON ResponseBuilder Object and am getting an exception when I try to. Do you have any suggestions on how to perform this function?

javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.HashSet, and Java type class java.util.HashSet, 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:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at org.neo4j.server.statistic.StatisticFilter.doFilter(StatisticFilter.java:62)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
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:926)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
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:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class java.util.HashSet, and Java type class java.util.HashSet, and MIME media type application/json was not found
... 25 more


Lasse Westh-Nielsen

unread,
Aug 14, 2012, 3:24:20 AM8/14/12
to ne...@googlegroups.com
Nicholas,

I can't remember if Jersey/ JSON work with Sets, but I do remember Maps and Lists wirk nicely - try converting your time to one of those perhaps?

Lasse

Nicholas Stuart

unread,
Aug 14, 2012, 9:58:45 AM8/14/12
to ne...@googlegroups.com, la...@neotechnology.com
It should just marshal it into a Collection, which it should be able to handle, but I changed it to a List/ArrayList and it was still the same error.

Nicholas Stuart

unread,
Aug 14, 2012, 1:25:09 PM8/14/12
to ne...@googlegroups.com, la...@neotechnology.com
So I got it working in a way. If I take my set and return it as a String, but with a @Produces of JSON, it returns it as a JSON list. 
Reply all
Reply to author
Forward
0 new messages