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.
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.
The connection to the HANA express edition fails with an “java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException” error.
Based on the information on StackOverflow (here) this problem is caused by
- using a JDK newer than JDK 8
- 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.
It works on my machine ;-)).
There you go, now you know!
Hello Lars, thanks for the detailed explanation of the error, appreciated. Best Regards Roland
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!
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?
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.
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.
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 🙁