Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
NoClassDefFoundError
June 9, 2014
21:54, EEST
Avatar
sanwar5@slb.com
Member
Members
Forum Posts: 4
Member Since:
June 9, 2014
sp_UserOfflineSmall Offline

Hi,

I am facing an issue with the running the example Android app. I have installed Android Developer Tools along with the corresponding JDK. I have downloaded all the dependencies including the jar files. When I’m trying to run the sample code, I get a NoClassDefFoundError, specifically with trying to execute the code on line 106 inside ConnectAndReadTimeTask.java as provided in the sample code. I tried many things, including copying the jar files into a libs folder inside my workspace.

It seems to me that the runtime doesn’t recognize the UaClient class as part of the third party library. I have definitely included the jar file Prosys-OPC-UA-Java-SDK-Client-Server-Evaluation-1.4.8-8731.jar. I think the issue is that the jar files are not being included in the runtime classpath. This is because I am not getting the error at compile time, but at runtime. I’m not sure what I should do. Is this a java runtime issue as I suspect? Any advice would be helpful!

June 10, 2014
7:40, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Did you notice my first comment to the Blog article?

You must also define the libraries that you use in the Order & Export section of the Build Path editor – and make sure that they are defined before the Android libraries.

June 10, 2014
12:22, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

The blog was actually updated today to another system, so the comments are not available any more. My quote was the important part, though.

June 10, 2014
14:49, EEST
Avatar
sanwar5@slb.com
Member
Members
Forum Posts: 4
Member Since:
June 9, 2014
sp_UserOfflineSmall Offline

Jouni Aro said

Did you notice my first comment to the Blog article?

You must also define the libraries that you use in the Order & Export section of the Build Path editor – and make sure that they are defined before the Android libraries.

Unfortunately that doesn’t seem to be working. Frown I have all my jars above my Android and Google libraries. My OpcUaSampleAppForAndroid src and gen libraries are also placed before the Android libraries. I tried playing around with this but nothing seems to be working. Should I be toggling the checkbox that is to the left side of the library and thus ‘export’ the library?

Just to clarify: I’m getting a NoClassDefFoundError, which means that the compiler is ok with everything, but the runtime isn’t. It’s complaining because when it tries to excute the line of code on line 106 of ConnectAndReadTimeTask.java:

UaClient myClient = new UaClient(serverUri);

it throws the stated error. The compiler is not complaining; this program is happily starting. However, when I try to read the time from the server, that’s when the runtime complains. Have you seen this kind of problem before?

Thanks!

June 10, 2014
16:33, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, you need to check every library for export: otherwise they are not copied to your Android device and cannot be found when the application starts. It’s weird that they are not checked by default.

June 10, 2014
19:24, EEST
Avatar
sanwar5@slb.com
Member
Members
Forum Posts: 4
Member Since:
June 9, 2014
sp_UserOfflineSmall Offline

Jouni Aro said

Yes, you need to check every library for export: otherwise they are not copied to your Android device and cannot be found when the application starts. It’s weird that they are not checked by default.

I’m afraid that’s still not working. I’m trying to run the app on my emulator. Would you like me to send you a screenshot of my build path and order and export? Is that possible to do here?

June 11, 2014
7:28, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

You can contact our support by email for that.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
56 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 734

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16, edgardo3518

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1