May 7 2009

Whenever I tried to get CollabNet for Eclipse plugin working in Eclipse PDT, it always failed, yielding the error “Unable to load SVN client” upon any SVN activity. I did endless amounts of Googling to try to solve the problem, but always came to a brick wall.

The big problem here is that Eclipse is just too new for Ubuntu – even Jaunty. An apt-get install subversion on Jaunty Jackalope will install subversion 1.5.4, which just doesn’t work, and thats where the big problem lies. CollabNet for Eclipse categorically requires Subversion 1.6. Unfortunately the only solution I’ve come up with is to compile subversion and it’s javahl bindings yourself. I’ll try and remember all the steps I took to make it work.

First, download the latest subversion and subversion-deps tgz from http://subversion.tigris.org/. At time of writing they are here and here. Extract them both:

$ tar zxvf subversion-1.6.1.tar.gz
$ tar zxvf subversion-deps-1.6.1.tar.gz
$ cd subversion-1.6.1

You’ll need to install a couple of extra packages (this assumes you’re using Sun’s JRE), and assuming you already had subversion and libsvn-javahl already installed, uninstall a couple:

$ sudo apt-get install libssl-dev sun-java6-jdk g++
$ sudo apt-get remove subversion libsvn-javahl

Configure, make and install subversion. You can check it’s the right version too:

$ ./configure --disable-nls --enable-javahl --with-jdk=/usr/lib/jvm/java-6-sun-1.6.0.13
$ make
$ sudo make install
$ svn --version

Once that’s done, you’ll want to compile the javahl binding. Once installed, check it’s installed correctly too. It’s fairly likely the .so file will be in /usr/local/lib.

$ make javahl
$ sudo make install-javahl
$ sudo updatedb
$ locate libsvnjavahl-1.so
$ sudo ldconfig

Open your eclipse.ini, and after the -vmargs line, add:

-Djava.library.path=/usr/local/lib

replacing the path with the path where the libsvnjavahl-1.so with your correct path.

Now fire up Eclipse, go to Window > Preferences > Team > SVN. The SVN Interface should now say JavaHL (JNI) 1.6.1 and a revision, depending on the particular version of SVN you installed.

I think that’s all the steps I took, so I apologise if I missed something out – if I remember something I’ll add it in!

Update: Compiling javahl requires g++, so I added that into the apt-get install line.

Update 2: Missed out ldconfig after libraries creation.

Update 3: If you still have issues getting it to work, I recommend looking at http://subclipse.tigris.org/wiki/JavaHL, reading it carefully, especially the Troubleshooting on Linux section. The javahltests.jar JUnit tests that are provided on the page may be very handy when debugging problems!

6 Responses to “JavaHL Not Available: Solution”

  1. Harry says:

    Thanks for the great post!

    I followed all the steps on Ubuntu 9.04 with Eclipse 3.4.2, but it still doesn’t work… the JavaHL unit tests all fail, with the error “1) testCreate(org.tigris.subversion.javahl.SVNAdminTests)java.lang.UnsatisfiedLinkError: /usr/local/lib/libsvnjavahl-1.so.0.0.0: /usr/local/lib/libsvn_ra_neon-1.so.0: undefined symbol: GSS_C_NT_HOSTBASED_SERVICE “.

    I googled around, and it seems the undefined symbol is related to the GSS-API library. I have the following files:
    “/usr/lib/libgss.so
    /usr/lib/libgss.so.0
    /usr/lib/libgss.so.0.0.23
    /usr/lib/libgssapi.so.2
    /usr/lib/libgssapi.so.2.0.0
    /usr/lib/libgssapi_krb5.so
    /usr/lib/libgssapi_krb5.so.2
    /usr/lib/libgssapi_krb5.so.2.2″, so I don’t see what the problem is.

    Any ideas?

  2. James says:

    Try:
    sudo apt-get install libneon27 libneon27-dev

    I’m not entirely sure of that problem, so it’s more of a stab in the dark.

    If not, try:
    ldd /usr/local/bin/svn

    And check all the library dependencies are resolved (i.e. have a path to the appropriate library).

  3. Harry says:

    Thanks for the advice! I installed the Neon libraries and redid everything, but the error is the same. Running ldd gives this:
    ” linux-gate.so.1 => (0xb80a1000)
    libsvn_client-1.so.0 => /usr/local/lib/libsvn_client-1.so.0 (0xb805f000)
    libsvn_wc-1.so.0 => /usr/local/lib/libsvn_wc-1.so.0 (0xb801c000)
    libsvn_ra-1.so.0 => /usr/local/lib/libsvn_ra-1.so.0 (0xb8011000)
    libsvn_diff-1.so.0 => /usr/local/lib/libsvn_diff-1.so.0 (0xb8004000)
    libsvn_ra_local-1.so.0 => /usr/local/lib/libsvn_ra_local-1.so.0 (0xb7ffc000)
    libsvn_repos-1.so.0 => /usr/local/lib/libsvn_repos-1.so.0 (0xb7fd5000)
    libsvn_fs-1.so.0 => /usr/local/lib/libsvn_fs-1.so.0 (0xb7fce000)
    libsvn_fs_fs-1.so.0 => /usr/local/lib/libsvn_fs_fs-1.so.0 (0xb7fa8000)
    libsvn_fs_util-1.so.0 => /usr/local/lib/libsvn_fs_util-1.so.0 (0xb7fa5000)
    libsvn_ra_svn-1.so.0 => /usr/local/lib/libsvn_ra_svn-1.so.0 (0xb7f92000)
    libsvn_ra_neon-1.so.0 => /usr/local/lib/libsvn_ra_neon-1.so.0 (0xb7f59000)
    libsvn_ra_serf-1.so.0 => /usr/local/lib/libsvn_ra_serf-1.so.0 (0xb7f39000)
    libserf-0.so.0 => /usr/local/serf/lib/libserf-0.so.0 (0xb7f29000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7eee000)
    libssl.so.0.9.8 => /lib/i686/cmov/libssl.so.0.9.8 (0xb7ea8000)
    libcrypto.so.0.9.8 => /lib/i686/cmov/libcrypto.so.0.9.8 (0xb7d5c000)
    libsvn_delta-1.so.0 => /usr/local/lib/libsvn_delta-1.so.0 (0xb7d51000)
    libsvn_subr-1.so.0 => /usr/local/lib/libsvn_subr-1.so.0 (0xb7ca1000)
    libaprutil-1.so.0 => /usr/local/apr/lib/libaprutil-1.so.0 (0xb7c83000)
    libapr-1.so.0 => /usr/local/apr/lib/libapr-1.so.0 (0xb7c5b000)
    libuuid.so.1 => /lib/libuuid.so.1 (0xb7c56000)
    librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7c4d000)
    libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb7c1a000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7c01000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7bfd000)
    libz.so.1 => /lib/libz.so.1 (0xb7be7000)
    libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xb7bbc000)
    libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb7b29000)
    libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb7b05000)
    libcom_err.so.2 => /lib/libcom_err.so.2 (0xb7b01000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb7ada000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7977000)
    /lib/ld-linux.so.2 (0xb80a2000)
    libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb796d000)
    libkeyutils.so.1 => /lib/libkeyutils.so.1 (0xb7969000)
    libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2 (0xb7953000)”
    so it seems there are no library dependency problems. In particular the “libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xb7bc1000)” line is correct.

    In the meantime I am learning to hate the svn command line :/

  4. James says:

    Hmm, as I’m no expert by any means I’m afraid I don’t have a solution for you. Are you using the CollabNet for Eclipse plug-in, or are you just using Subclipse? If you do not need to use CollabNet for Eclipse (which requires you to use specific versions of Subclipse and thus Subversion), then you can just downgrade to Subclipse 1.4, which should work fine on vanilla Ubuntu I think (it did for me in 8.10, but I needed to use CollabNet so it wasn’t an option for me).

  5. Harry says:

    Thanks for all the advice, I finally downgraded to Subclipse 1.4 and things work fine!

  6. James says:

    Glad things are working and sorry I couldn’t help you get the latest versions working… I’m sure the steps I took are right as I went through it on a pretty much new Ubuntu 9.04 install on my laptop and it worked fine… how odd! Maybe I installed something else that provided the symbol, I don’t know. Did you use Sun’s JDK or OpenJDK?

Leave a Reply