NoSuchMethod exception when using OData4j

34 views
Skip to first unread message

Izochrone

unread,
Apr 30, 2015, 7:36:25 AM4/30/15
to odata4j...@googlegroups.com
I've downloaded the odata4j archives and added odata4j-0.7.0-clientbundle.jar to my project.

I have created the following code:

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final TextView textView= ((TextView) findViewById(R.id.lblContent));
        Runnable runnable=new Runnable() {
            @Override
            public void run() {
                ODataConsumer consumer= ODataJerseyConsumer.create("http://localhost:49570/MyDataServices.svc");
                Enumerable<OEntity> list= consumer.getEntities("GetData").execute();
                for(OEntity oEntity:list)
                {
                 textView.setText(oEntity.getEntitySetName());
                }
            }
        };
        Thread t=new Thread(runnable);
        t.start();

    }

When I run it, I get the following exception:

 4899-4916/com.example.MyApp E/ProviderFactory﹕ The provider class, class com.sun.jersey.core.impl.provider.entity.RenderedImageProvider, could not be instantiated. Processing will continue but the class will not be utilized
    java.lang.NoSuchMethodException
            at java.lang.Class.getDeclaredMethods(Native Method)
            at java.lang.ClassCache.getDeclaredPublicMethods(ClassCache.java:153)
            at java.lang.ClassCache.getMethodsRecursive(ClassCache.java:216)
            at java.lang.ClassCache.findMethods(ClassCache.java:175)
            at java.lang.ClassCache.getMethods(ClassCache.java:167)
            at java.lang.Class.getMethods(Class.java:992)
            at com.sun.jersey.core.spi.component.ComponentInjector.inject(ComponentInjector.java:101)
            at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:142)
            at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:163)
            at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:134)
            at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:232)
            at com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServices(ProviderServices.java:149)
            at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:153)
            at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:145)
            at com.sun.jersey.api.client.Client.<init>(Client.java:275)
            at com.sun.jersey.api.client.Client.<init>(Client.java:150)
            at com.sun.jersey.api.client.Client.create(Client.java:476)
            at org.odata4j.jersey.consumer.DefaultJerseyClientFactory.createClient(DefaultJerseyClientFactory.java:22)
            at org.odata4j.jersey.consumer.JerseyClientUtil.newClient(JerseyClientUtil.java:53)
            at org.odata4j.jersey.consumer.ODataJerseyClient.<init>(ODataJerseyClient.java:59)
            at org.odata4j.jersey.consumer.ODataJerseyConsumer.<init>(ODataJerseyConsumer.java:25)
            at org.odata4j.jersey.consumer.ODataJerseyConsumer.<init>(ODataJerseyConsumer.java:14)
            at org.odata4j.jersey.consumer.ODataJerseyConsumer$Builder.build(ODataJerseyConsumer.java:93)
            at org.odata4j.jersey.consumer.ODataJerseyConsumer.create(ODataJerseyConsumer.java:115)
            at com.example.MyApp.MainActivity$1.run(MainActivity.java:25)
            at java.lang.Thread.run(Thread.java:1019)

I compile it with API level 16, minimum API level 10.

What should I modify?
Reply all
Reply to author
Forward
0 new messages