2

I have been working on creating a simple Java desktop app using the RESTful API for Business Objects and have run into an issue. Whenever I run my app in Eclipse in works fine; whenever I export it as a 'Runnable Jar' and select the Library handling option 'Package required libraries into generated JAR' it works fine. However, whenever I try to export it using the Library handling option 'Extract required libraries into generated JAR' I get the following error after running the app:

 java.lang.NoClassDefFoundError: Could not initialize class com.businessobjects.bcm.BCM

I have the 'bcm.jar' file added under a 'res' Source Folder and have it added to the Build Path. At one point I added all the JARs under the 'SAP BusinessObjects' java folder, and external folder, but it still throws the error. The problem stems from this line of code:

 enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userID, password, CMS, auth); 

Would anyone know why I am getting said error? I really want to use the Extract option as it will improve performance as my app becomes larger. Any help resolving this issue would be greatly appreciated :)

EDIT: I would be happy to provide clarification or further detail upon request!

Drew B
  • 465
  • 3
  • 6
  • 18
  • From https://stackoverflow.com/questions/9617420/difference-between-extracting-and-packaging-libraries-into-a-jar-file , the Main class is different in the two cases. – mikep Jun 24 '17 at 12:52
  • Hey mikep, thank you commenting :) I have looked at that exact post in the past and it is in part why I would like to use the Extract method over Packaging. While I understand the difference between packaging and extracting, I do not understand why this bcm.jar has issues when dozens of other SAP jar's do not. The only time I have trouble packaging my app is when I use this jar; I am trying to see if there is a way I can still package my app while using this jar. – Drew B Jun 24 '17 at 17:01
  • What does META-INF in bcm.jar look lijke (jar tvf)? – mikep Jun 24 '17 at 19:59
  • When I unzipped bcm.jar the manifest contained the following: `Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.0 Created-By: 20.12-b01 (Sun Microsystems Inc.) Product-Name: Business Objects BCM (C) Implementation-Title: Business Objects BCM Implementation-Version: 14.0.0.000 Implementation-Vendor: Business Objects, Inc.(C) Class-Path: cryptojFIPS.jar external/cryptojFIPS.jar` Please note that I have 'cryptojFIPS.jar' in the same folder as bcm.jar, and have it added to the Build Path of this app. – Drew B Jun 24 '17 at 20:45
  • So when you extract this MANIFEST.MF gets replaced? In your extracted jar, what does MANIFEST.MF look like? – mikep Jun 24 '17 at 21:00
  • When I extract my application the resulting jar only display's the following for the manifest when I unzip it: `Archive: C:/Users/Drew/Desktop/Application.jar inflating: META-INF/MANIFEST.MF`. It doesn't contain a `Rsrc-Class-Path` or anything like the packaged jar does. – Drew B Jun 24 '17 at 21:25
  • Cool. That's it. Could you replace the manifest with that from bcm.jar and try again? – mikep Jun 24 '17 at 23:01
  • Unfortunately I am not familiar with moving Manifest files from Jar's like that. The bcm.jar file is a SAP jar, and Eclipse creates the manifest file of my application automatically when I export it as a jar. Might you be able to explain how to get the manifest from bcm.jar, and replace it with the manifest in my application jar? – Drew B Jun 25 '17 at 00:08
  • In your META-INF directory in Eclipse, is there a MANIFEST.MF? – mikep Jun 25 '17 at 01:36
  • Unfortunately this cannot be done in Eclipse as I need a Runnable Jar, and while exporting Eclipse generates a MANIFEST.MF file automatically that will override any MANIFEST.MF file you currently have. Are there any other suggestions for fixing this issue? – Drew B Jun 26 '17 at 14:17

2 Answers2

1

Seems this was introduced in SP04 and SAP has no intent of fixing it as the RESTful API wasn't designed to be used with Desktop apps.

Brian Brian
  • 163
  • 1
  • 3
  • 17
0

Have you included the cryptojFIPS.jar? Leaving it out can cause the error.

fhossfel
  • 2,041
  • 16
  • 24
  • Hello fhossfel. Yes, I have included the cryptojFIPS.jar file under my 'res' folder and it is part of the Build Path. – Drew B Jun 28 '17 at 13:21
  • i'm just guessing but have you checked whether the bam.jar or the cryptojFIPS.jar contain other resources (like xml config files) that are not included in the unified jar? – fhossfel Jun 29 '17 at 21:39
  • From what I've seen the bcm.jar and cryptojFIPS.jar files only have classes under them, no XML files or anything. – Drew B Jun 30 '17 at 17:18