1

My problem is somewhat similar as in here : Unable to resolve superclass error when referencing .jar library

I have tried the solution there, but not working for me.

So, First I created java source from WSDL file using wsimport. And added this source to Java project. Imported this java project as library to the Android project. Exported the library in Order and Export in the build path. Tried different order for gen and src folders and also the library folder. When I call the method in the web service it does not work.

Here is the warning :

    08-29 14:06:27.810: W/dalvikvm(20711): Unable to resolve superclass of Lcom/example/SampleService; (1270)
    08-29 14:06:27.810: W/dalvikvm(20711): Link of class 'Lcom/example/SampleService;' failed
    08-29 14:06:27.810: E/dalvikvm(20711): Could not find class 'com.example.SampleService', referenced from method com.example.demo.RequestSingleton

And also I get NoClassDefFoundError for the class "SampleService.java" which is a generated class from the WSDL and the subclass of javax.xml.ws.Service.

Log :

    08-29 14:06:27.815: E/AndroidRuntime(20711): FATAL EXCEPTION: AsyncTask #1
    08-29 14:06:27.815: E/AndroidRuntime(20711): Process: com.example.demo, PID: 20711
    08-29 14:06:27.815: E/AndroidRuntime(20711): java.lang.RuntimeException: An error occured while executing doInBackground()
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at android.os.AsyncTask$3.done(AsyncTask.java:300)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at java.lang.Thread.run(Thread.java:841)
    08-29 14:06:27.815: E/AndroidRuntime(20711): Caused by: java.lang.NoClassDefFoundError: com.example.SampleService
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at com.example.demo.RequestSingleton.callWebService(RequestSingleton.java:52)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at com.example.demo.Request$callWebService.doInBackground(Request.java:104)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at com.example.demo.Request$callWebService.doInBackground(Request.java:1)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at android.os.AsyncTask$2.call(AsyncTask.java:288)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    08-29 14:06:27.815: E/AndroidRuntime(20711):    ... 4 more

I have also tried to create a jar from this java project and add it to the libs folder in the Android project and added to the build path. Does not work.

I have also created an Android project with the WSDL generated source and added this as library to the android application project. Does not work.

Tried importing the JRE Systrem Library to the android project. Does not work either.

Can someone help me here?

Thanks in advance.

Community
  • 1
  • 1
quad
  • 872
  • 3
  • 17
  • 37
  • Have you tried exporting the jar? By exporting i mean: go into build path setting in eclipse -> find the jar -> mark the checkbox next to it -> clean project (important) -> build – Jitsu Aug 29 '14 at 12:42
  • You mean in the "Order and Export" right ? Yes I have tried it. – quad Aug 29 '14 at 12:44
  • I see. Maybe in the same window (order and export) try to move the library WAY UP to the top, so it will cover the android SDK, and anything you may have there. – Jitsu Aug 29 '14 at 12:48
  • I had tried this with library itself. Now tried with jar as well. But both not working. Same error. – quad Aug 29 '14 at 12:51
  • Maybe post the code for the service, and the service call. Looks like you may have some typo. – Jitsu Aug 29 '14 at 13:23
  • I had also the same problem, but the solution for me was that the library that im referencing had a jar file library that i also referenced in the main project. so there was a conflict by their v4 package. I had to remove the library referenced by that project and referenced it from the projects that have been imported in my eclipse. – Spurdow Aug 29 '14 at 13:48

0 Answers0