Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
phirons
Posts: 4
Registered: ‎09-20-2012
My Device: 9900
Accepted Solution

NoClassDefFoundError with Bouncy Castle libraries

Hi,

 

I have build and preverified the bccore and bcpkix Bouncy Castle libraries and have included them in a BlackBerry project in Eclipse using the 7.1.0 BlackBerry SDK plugin.

 

When attempting to instantiate the CMSSignedData class I am seeing a NoClassDefFoundError exception being thrown.  The exception returns nothing from getMessage() and printStackTrace() just shows "no stack trace".

 

Any ideas?

 

Thanks.

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: NoClassDefFoundError with Bouncy Castle libraries

Make sure you have followed all of the steps here.  It looks like you may have missed step 3.

 

A library and how to use it

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
phirons
Posts: 4
Registered: ‎09-20-2012
My Device: 9900

Re: NoClassDefFoundError with Bouncy Castle libraries

[ Edited ]

After building the 2 Bouncy Castle libraries as BlackBerry Library projects, then including the jars from their respective "deliverables/standard/7.1.0" directories I get a "A project can only export one midlet jar" error in the application project that uses them.

 

To avoid this error in the past, I have compiled the library projects against the RIM net_rim_api.jar with the target and source parameters set to 1.2 and 1.3, then run jar on the results followed by preverify.

 

Note: I am using Eclipse with the BB 7.1.0 plugin rather than the BB SDK as a whole.

 

 Note also:  The 2 library jars are definitely included in the build output of the BB application, this is not a simple case of the library classes not being present.  Mot of the BC library calls work fine, it is just this one (CMSSignedData) so far that has caused a problem.

New Contributor
phirons
Posts: 4
Registered: ‎09-20-2012
My Device: 9900

Re: NoClassDefFoundError with Bouncy Castle libraries

I have simplified the issue and removed the possibility of this being a library related problem.

 

I have now recompiled my test application with no libraries included and instead added the Bouncy Castle source code to the application.  The NoClassDefFoundError still occurs when the application is run in the BlackBerry simulator or directly on a phone.

 

I am using the cldc sources from the Bouncy Castle 1.47 release.  The only change I have made is to refactor the code to rename the 4 java.* packages which are not allowed in BB deployments.

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: NoClassDefFoundError with Bouncy Castle libraries

Are you building the BoucnyCastle code into a cod file that you are including with your application?

New Contributor
phirons
Posts: 4
Registered: ‎09-20-2012
My Device: 9900

Re: NoClassDefFoundError with Bouncy Castle libraries

The problem is now solved.  There is an issue with using the Bouncy Castle code (even with it included directly as source code in my test application) when built against the BB 7.1.0 JDE.  Rebuilding the project against the BB 7.0.0 JDE fixes the problem.