Using External jars as a Library causes java.lang.NoClassDefFoundError | Telit Cinterion IoT Developer Community
May 17, 2017 - 5:24pm, 40554 views
Hi,
I am running my MIDlet on the EHS5 and it gives me NoClassDefFoundError. I have tried to follow the previous thread : https://iot-developer.thalesgroup.com/threads/using-external-jars-library , but it didn't solve my problem. I have added my external jars to the Build Path (in libarires) as well as checked it in (Order and Export) , but the the problem still exists. Can anyone provide me a solution to that? Thanks .
Hello,
I assume that this exception is connected with the class from the jar library.
In most cases the problem is in the proper configuration of exporting but it's probably not the case here. And how about the library - was it created or built by you? Are you sure that it is compatible with the Java version on the module? Are you using the obfuscater?
Have you checked if the appropriate class files are really placed inside the jar file? Have you also tried to use the source files instead of a jar library?
Regards,
Bartłomiej
Hello Mr. Bartlomiej,
These libraries are from some other vendor. Yes, they are compatible with the Java version module. They are actually not given as jar, but as a zip file. Since the jar file also contains class files, adding it through a .zip file shouldn't create any problems (Your Comments on that ?). I am not sure about what is obfuscater.
Would it be possible to use eclipse to build the MIDlet without connecting the module through Serial to the PC as mentioned in the Java document of EHS5 ? Currently I am following this link in order to run a MIDlet on EHS5 module https://iot-developer.thalesgroup.com/tutorial/hello-world-application. In the end I create a .jad and .jar files and copy it to the module and run it. If its possible to build without the EHS5 module kindly share links or resources. Thanks.
Hello,
It should be jar file and not zip - you can check if the files form the library were exported by unpackaging the MIDlet jar file - if the files are not there you need to replace the zip archive with jar and this should solve the problem.
Obfuscation reduces the result jar file size and makes it harder to reverse engineer.
You can develop and build the code without connection the module but you are unable to test the result on the device. There is no software device simulator. There is a way to run and debug the code directly from Eclipse or Netbeans but then the physical device is still needed.
Best regards,
Bartłomiej
Hello Mr. Bartlomiej,
It seems that this was not a problem with the jar file. It was probably obfuscation problem. I have used Ant Scripts in eclipse which creats a .jad and .jar files and then I run it on the module and everything works fine.
It would have been great if the code can be tested on some simulator ( it would time effective ), but since you mentioned it's not possible I will try to test it using the conventional method described in the Java Guide Manual.
Best Regards,
Umair
Hello,
Good that it's working with ANT. So it must have been some problem in the project configuration or the standard builder ***** jar instead of zip.
Unfortunately there's no simulator. There's only a solution that uses a real hardware for debugging.
Regards,
Bartłomiej
Hello,
Regarding Debugging:
- Is it possible to use break points while debugging if real hardware is connected ?
- I am assuming debugging would include everything like we do conventionally on windows PC.
- Is there any other document related to debugging only except for JAVA EHS5 Guide ?
Best Regards,
Umair
Hello,
The debugging works in the same way, just the real hardware is used instead of simulator the special debug connection is established between the PC and module for that purpose.
The Java User's Guide is the document that describes on device debugging and other Java related topics.
Best regards,
Bartłomiej
Hello,
Regarding Debugging again : I am following this thread https://iot-developer.thalesgroup.com/threads/imp-debug-connection-fails... , and you have mentioned/also in the manual that DCD0, DTR0 and DSR0 should be configured for all the interfaces.
Questions:
- I have enabled System.out on COM1 (ASC0). Should I disable it before enabling DCDO, DTRO and DSR0.
- Does it really mean communicationg using an IP Address ( Sim card required ?).
- I am getting an error which I have added as a picture after following this thread :https://iot-developer.thalesgroup.com/threads/problems-getting-eclipse-j...
I am using windows 7 64 bit.
Best Regards,
Umair
Hello,
You shouldn't need to disable the System.out on ASC0 if you are not using this interface as debug interface but you should configure DCDO, DTRO and DSR0 lines to "std".
SIM card is required and the debug communication is using the IP addresses - you need to provide that the traffic is not blocked by the firewall.
Windows 7 is supported.
Generally you should follow the instructions in Java User's Guide.
Wasn't there any other information after closing the window from Eclipse? That might be helpful.
Regards,
Bartłomiej
Hello Mr. Bartlomiej,
Thanks for your E-mail. I am still getting an error while trying to get in on-device-debugging mode. Here are some outputs :
AT^SCFG=?
^SCFG: "Audio/Loop",("0","1")
^SCFG: "Call/Ecall/AckTimeout",("0-2147483646")
^SCFG: "Call/Ecall/Callback",("0","1")
^SCFG: "Call/Ecall/CallbackTimeout",("0-2147483646")
^SCFG: "Call/Ecall/Msd",("280")
^SCFG: "Call/Ecall/Pullmode",("0","1")
^SCFG: "Call/Ecall/SessionTimeout",("0-2147483646")
^SCFG: "Call/Ecall/StartTimeout",("0-2147483646")
^SCFG: "Call/ECC",("0"-"255")
^SCFG: "Call/Speech/Codec",("0","1")
^SCFG: "Gpio/mode/ASC1",("std","gpio","rsv")
^SCFG: "Gpio/mode/DAI",("std","gpio","rsv")
^SCFG: "Gpio/mode/DCD0",("std","gpio","rsv")
^SCFG: "Gpio/mode/DSR0",("std","gpio","rsv")
^SCFG: "Gpio/mode/DTR0",("std","gpio","rsv")
^SCFG: "Gpio/mode/FSR",("std","gpio","rsv")
^SCFG: "Gpio/mode/PULSE",("std","gpio","rsv")
^SCFG: "Gpio/mode/PWM",("std","gpio","rsv")
^SCFG: "Gpio/mode/RING0",("std","gpio","rsv")
^SCFG: "Gpio/mode/SPI",("std","gpio","rsv")
^SCFG: "Gpio/mode/SYNC",("std","gpio","rsv")
^SCFG: "GPRS/AutoAttach",("disabled","enabled")
^SCFG: "Ident/Manufacturer",(25)
^SCFG: "Ident/Product",(25)
^SCFG: "MEopMode/Dormancy",("0","1")
^SCFG: "MEopMode/SoR",("off","on")
^SCFG: "MEShutdown/Fso",("0","1")
^SCFG: "MEShutdown/sVsup/threshold",("-4","-3","-2","-1","0","1","2","3","4"),("0")
^SCFG: "Radio/Band",("1"-"147")
^SCFG: "Radio/OutputPowerReduction",("0","1","2","3","4")
^SCFG: "Serial/Interface/Allocation",("0","1","2"),("0","1","2")
^SCFG: "Serial/USB/DDD",("0","1"),("0"),(4),(4),(4),(63),(63),(4)
^SCFG: "Tcp/IRT",("1"-"60")
^SCFG: "Tcp/MR",("1"-"30")
^SCFG: "Tcp/OT",("1"-"6000")
^SCFG: "Tcp/WithURCs",("on","off")
^SCFG: "Trace/Syslog/OTAP",("0","1"),("null","asc0","asc1","usb","usb1","usb2","usb3","usb4","usb5","file","udp","system"),("1"-"65535"),(125),("buffered","secure"),("off","on")
^SCFG: "Userware/Autostart",("0","1")
^SCFG: "Userware/Autostart/Delay",("0"-"10000")
^SCFG: "Userware/DebugInterface",("0"-"255")|("FE80::"-"FE80::FFFFFFFFFFFFFFFF"),("0"-"255")|("FE80::"-"FE80::FFFFFFFFFFFFFFFF"),("0","1")
^SCFG: "Userware/DebugMode",("off","on")
^SCFG: "Userware/Passwd",("0"-"8")
^SCFG: "Userware/Stdout",("null","asc0","asc1","usb","usb1","usb2","usb3","usb4","usb5","file","udp","system"),("1"-"65535"),("0"-"125"),("buffered","secure"),("off","on")
^SCFG: "Userware/Watchdog",("0","1","2")
OK
ati1
Cinterion
EHS5-E
REVISION 03.001
A-REVISION 00.000.42
OK
I have tried a new laptop which has windows 7 64-bit and administrator privileges. I have turned all the firewalls off, so that the traffic can't be blocked, but still I am getting this error(Failed to connect to remote debugging device). Here is the error.
Error.png ... Any hints on where I am doing wrong ?
-I have inserted the Sim card as well.
Best Regards,
Umair
Pages