Hi Alex,

Thanks for your report. I've just fixed the potential NPE in the JsonConverter 
class and in other similar converters.

Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.o​rg
Noelios Technologies ~ http://www.noelios.com

-----Message d'origine-----
De : Alexander Kampmann [mailto:campino_a...@gmx.de] 
Envoyé : mardi 22 juin 2010 17:58
À : discuss@restlet.tigris.org
Objet : A problem concerning JsonConverter

hi, 

i'm very new to restlet, so please don't be annoyed if my questions are silly 
;) 

My set- up is a spring- based web service, which uses Restlet for 
communication. It is deployed to Tomcat. web.xml is setting up an 
RestletFrameworkServlet. The servlet's spring config file uses a SpringRouter 
and two SpringFinders to register an TestRestlet and my real Restlet. The test 
works fine. It simply returns a string as answer to any get request and can be 
visited using a browser. 

The problem goes together with the other Restlet. It extends ServerResource and 
implements a custom Interface. The interface looks like that: 

public interface JSService {
        @Post("json")
        public abstract JSONObject execute(JSONObject data); }

The Restlet itself returns a json object. 

I connect to the interface using ClientResource and its wrap method. So I get 
an Instance of JSService (my interface) on the client- side (written in Apache 
Wicket, if this is important). 

Calling execute() at this Instance leads to a NullPointerException in line 97 
of JsonConverter (there is an excerpt from the log file below. There is clearly 
the client side failing, the request never reaches the server), the log says 
"Unable to get the score of the org.restlet.ext.json.jsonconver...@1862621 
converter helper. "

I'll be thankful for all suggestions. 

Greetings,
Alex

And that's the log file: 

Jun 22, 2010 5:34:43 PM org.restlet.engine.converter.ConverterUtils 
getBestHelper
SEVERE: Unable get the score of the org.restlet.ext.json.jsonconver...@1862621 
converter helper.
java.lang.NullPointerException
        at org.restlet.ext.json.JsonConverter.score(JsonConverter.java:97)
        at 
org.restlet.engine.converter.ConverterUtils.getBestHelper(ConverterUtils.java:121)
        at 
org.restlet.service.ConverterService.toRepresentation(ConverterService.java:206)
        at 
org.restlet.service.ConverterService.toRepresentation(ConverterService.java:189)
        at 
org.restlet.resource.ClientResource.toRepresentation(ClientResource.java:1475)
        at 
org.restlet.resource.ClientResource$1.invoke(ClientResource.java:1573)
        at $Proxy49.execute(Unknown Source)
--
GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.  
Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2624625

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2653018

Reply via email to