Hello,
there is a problem with ServiceFinder on android platform, see this
thread for workaround:
http://jersey.576304.n2.nabble.com/java-lang-NullPointerException-on-Android-td4212447.html
Regards,
Pavel
On 12/12/11 2:50 PM, takeshi honda wrote:
> *Hi,*
> **
> *I'm trying to make http cilent with jersey1.10.*
> *I made an simple code as follows.*
> Client client = Client.create();
> WebResource wr = client.resource("http://www.yahoo.co.jp/
> <http://www.google.com/url?sa=D&q=http://www.yahoo.co.jp/&usg=AFQjCNH8Oq_RDLTkjGHXSm_BA4I_MPqjNg>");
>
> String result = wr.get(String.class); // NullPointerException
> But I got the following error.
> I use two jars.
> *jersey*-client-1.10.jar
> *jersey*-core-1.10.jar
> How can I fix this problem?
> java.lang.NullPointerException
> at javax.ws.rs.core.MediaType.valueOf(MediaType.java:119)
> at
> com.sun.*jersey*.api.client.ClientResponse.getType(ClientResponse.java:
> 615)
> at
> com.sun.*jersey*.api.client.ClientResponse.getEntity(ClientResponse.java:
> 532)
> at
> com.sun.*jersey*.api.client.ClientResponse.getEntity(ClientResponse.java:
> 506)
> at com.sun.*jersey*.api.client.WebResource.handle(WebResource.java:
> 674)
> at com.sun.*jersey*.api.client.WebResource.get(WebResource.java:191)
> at jp.localhost.study.httpc.httpc.onCreate(httpc.java:41)
> at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1047)
> at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2674)
> at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2726)
> at android.app.ActivityThread.access$2300(ActivityThread.java:128)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
> 2074)
> at android.os.Handler.dispatchMessage(Handler.java:99)
> at android.os.Looper.loop(Looper.java:123)
> at android.app.ActivityThread.main(ActivityThread.java:4680)
> at java.lang.reflect.Method.invokeNative(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:521)
> at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:858)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
> at dalvik.system.NativeStart.main(Native Method)