Debug xquery in eclipse. Configuration

So you want to run xquery in eclipse. You eventually find your way to XQDT. Some concern that we’re working with beta software (version 0.8.0 as of this post), but you bravely forge ahead. You survive the installation and run into your first roadblock at the getting started. Here you discover that they are working with Zorba 0.9.4 (later you suspect this is a misprint, but never mind) and do NOT SUPPORT DEBUGGING! If you can’t debug, this is DOA.

You follow the note to install Zorba from the subversion trunk, but this is a C project and no compiled distributions. Dead end 1.

You download and install Zorba itself (version 1.4.0), and while it runs, you are unable to debug. (Perhaps you can, but you never figured it out and got impatient. Plus, you refuse to depend on other programs installed in Windows anyway, because this is a distribution/installation hell.) Probably dead end 2.

You hear about the 28msec Sausalito project. They apparently have a version of Zorba that supports debugging. Looking better, but you don’t want a separate Eclipse installation. After a bit of exploration, you figure out to how attach the Sausalito project code to your existing Eclipse installation:

1) Install XQDT into Eclipse as normal. Steps described here

2) Download the Sausalito project from here, and extract the zipped contents.

3) Navigate to the plugins/com.28.msec.sausalito.win32/coresdk/bin directory.

Note: In my download, the path is com.28msec.sausalito.win32_1.2.10.201011291638

4) Copy the contents of this directory into your existing Eclipse project. (Put it somewhere convenient, of course, such as /lib/sausalito,)

Note: Obviously, you do not need all the contents of this directory. I do not yet know which files are required, and which are not. I know the zorba-sausastore.exe file is required, along with some others.

5) Now to add the new intepreter to Eclipse. Open Preferences -> XQuery -> Interpreters. Click the “Add…” button, then the “Browse” button. Navigate to the zorba-sausastore.exe file you just added, and select it. Eclipse should be able to inspect the file and set the default Interpreter name, e.g.,

Click ok and make the new Interpreter the default (or change it only for the one project).

And that should do it. Look see 🙂

I find it odd that Zorba is up to version 1.5.0, but XQDT is back on 0.9.4.

I also have NOT done anything with a Linux install. Obviously, you won’t have a win32 directory, but you’ll know what you’re doing anyway.

6 thoughts on “Debug xquery in eclipse. Configuration

  1. Wasted several hrs trying to run Zorba from within java via JNA. Obviously it can be done, but I can’t find the magic combination. Very skimpy instructions. Where the “zorba_api” file mentioned in that link? Tried sausalito, zorba. Tried to install zorba and link via the PATH. Something goes wrong with each option. I am stumped.

  2. Anomymous, I was able to get it to work in windows with some expert help and a few hrs.

    Not perfectly, because I still have to keep the installed zorba app lying around. Ideally one should be able to delete it, but something is failing when I do.

    1) Download and install the built binary for zorba.

    1a) You do NOT have to add the new directory to the PATH variable.

    2) Create an Eclipse java project. Create a libs directory inside the project.

    3) Copy the “zorba_api.dll” file from [zorba-install]/bin/java/org/zorbaxquery/api to the new libs directory.

    4) Copy the “zorba_simplestore.dll” file from [zorba-install]/bin/ to the new libs directory.

    5) In the Java Build path -> Libraries tab, click the “Add Class Folder” and add the lib directory.

    6) Edit the “Native library location” to point to the libs directory.

    7) import the java classes from [zorba-install]/bin/java to the project.

    8) Modify the Test_Zorba class to also import the zorba_simplestore.dll. Class loading timing can be tricky, so I recommend using a static init() method (and calling it obviously) rather than a static block:

    public static void init()
    System.loadLibrary ( “zorba_api” );
    System.loadLibrary ( “zorba_simplestore” );

    And that should do it. Or close to doing it. I also wound up moving the above static init() method to the class, because it was possible for the location of the Test_Java class to screw things up. Having the loadLibrary methods in the same directory as the dll files is safer.

    It is really annoying to have to keep the installed zorba app around. That essentially destroys easy remote installation. Still working on that problem.

  3. i also cannot make zorba with java work i am using
    zorba 2.1.0 there is no [zorba-install]/bin/java
    they do have [zorba-install]\share\java but no class files there. i am stuck.

  4. “Debug xquery in eclipse. Configuration | Clever Caboose” in fact got
    me hooked with ur web site! Iwill wind up being back again way
    more frequently. With thanks ,Colby

Leave a Reply

Your email address will not be published. Required fields are marked *