Skip to content

[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 found myself digging up multiple times over the course of the past year. So I figured, I’ll make a note to myself (NTM) and put it into a blog post for even easier retrieval in the future.

Update 25.11.2020

After I don’t know how many months, SAP has finally decided to provide an updated HANA Eclipse Plugin that works with Java 11.

Just go and get it at https://tools.hana.ondemand.com/#hanatools, respectively install it into your Eclipse 2020-09 (4.17).

This means: the whole mucking around with the java version on your machine is finally over.

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

The easy fix

I’m no 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 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 (right-click on the application icon and choose “Show Package Contents”) and edit the ./Contents/info.plist file. macOS uses this file to determine the runtime environment for the application.

This XML file has a section/key for “Eclipse” – including a comment on how to set a specific JDK VM.
I inserted the <string> section for the most recent JDK 8 (1.8.0_191) on my computer 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.

Geek and Poke cartoon: developer saying "on my machine it works" to another developer
Geek and Poke: Advanced YIW = OMMIW

It works on my machine ;-)).

There you go, now you know!

7 thoughts on “[NTM] HANA STUDIO NoClassDefFoundError: javax/xml/soap/SOAPException”

  1. I’m working on an unrelated generic kotlin project, and was looking for this particular NoClassDefFoundError error, for the same javax/xml/soap/SOAPException

    After stumbled with this page, turns out your solution worked: I was compiling my Kotlin project with Java 11 whereas it needed to do it with Java 8

    So, thank you so much for this! works not only for Hana Studio issues!

  2. Hi Lars,
    unfortunatelym it does not work for me: I have a (linux) Hana Studio installation on one machine, it uses JDK 11 and this error is not raised (!?). I have copied everything from this machine to another one and I cannot get rid of this error there, setting jdk version to 8 won’t help. Do you have any idea what to do here?

    — Micha

  3. I knew that posting here will help 🙂 Eclipse can be given the command-line argument -vm and when I give it the 8 JDK, it works. This does not tell why the default works on one machine a not on the other, but this is not a high-priority problem. So thanks anyway.

    1. Hi Micha,

      changing the -vm key entry in the ./Contents/info.plist file as described in the post has precisely the same effect as using the command line parameter -vm. I’m not sure what the preferences file is called on Linux (on Windows it’s eclipse.ini, for more info see here) but it should be possible to set the target VM permanently there, too.

      Anyhow, thanks for coming back with another comment clarifying the solution you found.
      Cheers,
      Lars

  4. It just doesnt work – once the path is swapped as per windows instructions, eclipse demands the JAva 11 version with an error – could not create java virtual machine. a fatal exception has occured. program will exit. I ran out of ideas 🙁

Leave a Reply

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

%d bloggers like this: