![]() |
J2ME error?? Hi, I'm a .NET developer by trade so still getting my head round this Java stuff. I'm calling a WebService using KSoap2. I got a demo working just using standard Java app using the ksoap2-j2se-full-2.1.2.jar. I could not get this jar file to verify so i tried using the ksoap2-j2me-core-2.1.2.jar as I verify this. Now when I add it to the project I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: javax/microedition/io/Connector at org.ksoap2.transport.ServiceConnectionMidp.<init>( Unknown Source) at org.ksoap2.transport.HttpTransport.getServiceConne ction(Unknown Source) at org.ksoap2.transport.HttpTransport.call(Unknown Source) at FirstClass.GetResult(FirstClass.java:50) at FirstClass.main(FirstClass.java:22) Caused by: java.lang.ClassNotFoundException: javax.microedition.io.Connector at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 5 more Is this to do with me not using J2ME??? If so is this part of the J2SE? Or am I missing something more obvious? My code is as follows: (i've added ** as i can't post links) public static String GetResult() { String result = ""; SoapObject soap = new SoapObject("**localhost/BBWebservice", "HelloWorld"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(soap); /*With J2SE version would use the following line which worked *HttpTransportSE ht = new HttpTransportSE("**localhost/BBWebservice/service.asmx"); */ HttpTransport ht = new HttpTransport("**localhost/BBWebservice/service.asmx"); ht.debug = true; try{ System.out.println("CALLING WEBSERVICE"); ht.call("**localhost/BBWebservice/HelloWorld", envelope); System.out.println("GETTING RESPONSE"); result = (envelope.getResponse()).toString(); } catch(Exception ex){ System.out.println("ERROR: "+ ex.toString()); } finally { System.out.println("Finished"); } return result; } |
Hi the problem come from the ksoap you use. It's the full for J2SE Or blackberry is on J2ME. SourceForge.net: Files and take the ksoap2-j2me-core-2.1.2.jar and don't forget to preverify it preverify -classpath "C:\Program Files\Research In Motion\BlackBerry JDE 4.3.0\lib\net_rim_api.jar" Path_where_the_jar_is_located\ksoap2-j2me-core-2.1.2.jar And recover the jar in the output folder located in C:\Program Files\Research In Motion\BlackBerry JDE 4.3.0\bin. With this all should be ok |
Hi, Thanks for the reply. I am using the preverified ksoap2-j2me-core-2.1.2.jar file. Do you think the problem could be that i am using it within Eclipse J2SE? Would i need to download eclipse J2ME?? |
Quote:
|
Yes because in fact eclipse is in J2SE and so can't use the J2ME package. Take the BlackBerry Plugging as baran_khan said |
I'm already using the Blackberry plugin for eclipse and i'm still getting the error. So if i can't use J2ME package with J2SE then the ksoap2-j2me-core-2.1.2.jar won't work? In that case i will have to use the ksoap2-j2se-full-2.1.2.jar? I can't get this to verify... so frustrating! |
Hi, I just saw your code, are you using "localhost" in the web service address? Cause if it is so, the blackberry consider it as its local resource within the device and will never look outside...SO put the IP address instead of that localhost term. Secondly, you have to have core version of ksoap2, you can't preverify any other version... |
Quote:
|
Quote:
MAybe i'm not explainin it correctly as i'm not a java developer, i'm .net and webdeveloper normally. I have downloaded and installed the blackberry plugin for Eclipse and created a blackberry project where i develop all of the applications for a blackberry. I have a library project with the preverified core ksoap2 jar inside and added this as a reference for the project containing the actual code... i was trying to work out if the j2me was an issue as my understanding of the underlying technologies in Java is not so thorough. I will try your comment about using ip address rather than localhost and hopefully get somewhere with that. |
I've tried using the ip address instead of the localhost and i'm still getting nothing. I'm confused about the ME/SE/RIM thing. Any recommended reading to catch up? |
| All times are GMT -5. The time now is 07:16 PM. |
Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.