[NTM] HANA STUDIO NoClassDefFoundError: javax/xml/soap/SOAPException

Sometimes, when I am looking for the solution to a problem by googling, I find my own blog posts or forum replies. These found-again solutions are one of the nice returns from prolonged activity in forums and usually a reminder of how much my detail memory behaves like a colander sometimes…

Anyhow, this is one of those cases, that I fond myself digging up multiple times over the course of the past year. So I figured, I make a note to myself (NTM) and but it into a blog post for even easier retrieval in the future.

Original post

https://answers.sap.com/questions/698488/eclipse-photon-connection-to-hana-express.html, 04.12.2018

Problem

The connection to the HANA express edition fails with an “java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException” error.

Solution

Based on the information on StackOverflow (here) this problem is caused by

  • using a JDK newer than JDK 8

and

  • the fact that the package that contains code for XML/SOAP handling had been moved to a different Java module

I’m not a JDK expert, but the easiest solution I found working for me was to make sure that my eclipse uses the JDK 8 on my mac.

First I checked what JDKs are installed on the machine and where they are located:

/usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    11.0.1, x86_64:	"OpenJDK 11.0.1"	/Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home
    1.8.0_191, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
    1.8.0_181, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home

This means, there are 3 JDKs on my machine in total (two for JAVA SE 8 and for JAVA 11). The newest one (JDK 11) is the default JDK.

That’s the one (the latest) eclipse on macOS uses by default. To change that, you open the ECLIPSE package contents (in the Applications folder) and edit the ./Contents/info.plist file. This file is used by macOS to determine the runtime environment for the application.

In this XML file there is a section for “Eclipse” with a comment that instructs you how to set a specific JDK VM.
I simply inserted the <string> section for my most recent JDK 8 (1.8.0_191) like so:

<key>Eclipse</key>
 <array>
 <!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
 or add a VM found via $/usr/libexec/java_home -V
 <string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
 <string>-vm</string><string>/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home/bin/java</string>
 -->
 <string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java</string>
 <string>-keyring</string>
      <string>~/.eclipse_keyring</string>
 </array>

After saving this file, restart eclipse as usual and the problem should be solved (it is on my machine ;-)).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.