Re: Running Calabash from a terminal (Linux)

For reference, here's a complete script that installs Calabash automatically
on Ubuntu 10.04:

---- start calabash-setup.sh ----
#!/bin/sh

# This script installs Calabash and its Saxon dependency, and is tested to
# work on a fresh Ubuntu 10.04 setup. The script uses Calabash 0.9.21 and
# Saxon HE 9.2.1.1. For newer versions, update the following URLs
# accordingly. This script is provided without warranty etc. etc.
SAXON_URL='
http://sourceforge.net/projects/saxon/files/Saxon-HE/9.2/saxonhe9-2-1-1j.zip/download
'
CALABASH_URL='http://xmlcalabash.com/download/calabash-0.9.21.zip'

echo "\n\nMaking sure Java is installed..."
sudo apt-get install openjdk-6-jdk

echo "\n\nInstalling Saxon HE 9.2..."
wget $SAXON_URL -O saxon9he_tmp.zip
unzip saxon9he_tmp.zip -d saxon9he_tmp
sudo mv saxon9he_tmp/saxon9he.jar /usr/share/java/
sudo ln --symbolic -f -T /usr/share/java/saxon9he.jar
/usr/share/java/saxon.jar

echo "\n\nInstalling Calabash 0.9..."
wget $CALABASH_URL -O calabash_tmp.zip
unzip calabash_tmp.zip -d calabash_tmp
sudo mv calabash_tmp/calabash*/lib/calabash.jar /usr/share/java/

echo '#!/bin/sh

CLASSPATH=/usr/share/java/calabash.jar\
:/usr/share/java/saxon.jar
# Add additional libraries here (Jing, TagSoup, etc)

java -cp $CLASSPATH com.xmlcalabash.drivers.Main $@' | sudo tee
/usr/bin/calabash

sudo chmod +x /usr/bin/calabash

echo "\n\nRunning XProc test-script..."
calabash calabash_tmp/calabash*/xpl/pipe.xpl

echo "\n\nCleaning up..."
rm -rf saxon9he_tmp.zip saxon9he_tmp calabash_tmp.zip calabash_tmp
---- end calabash-setup.sh ----

Regards
Jostein


2010/6/17 Jostein Austvik Jacobsen <josteinaj@gmail.com>

> Ah, of course! Thanks Romain.
>
> jostein@jostein-laptop:~$ calabash pipe.xpl
> Jun 17, 2010 11:30:19 AM com.xmlcalabash.util.DefaultXProcMessageListener
> info
> INFO:
> file:/home/jostein/Skrivebord/calabash/calabash-0.9.21/xpl/pipe.xpl:2:
> Running anonymousType_1 #ANON.85
> Jun 17, 2010 11:30:19 AM com.xmlcalabash.util.DefaultXProcMessageListener
> info
> INFO: Running #ANON.86
> <doc>
> Congratulations! You've run your first pipeline!
> </doc>
>
> Regards
> Jostein
>
>
> 2010/6/16 Romain Deltour <rdeltour@gmail.com>
>
> I think the problem comes from your use of -Xbootclasspath to set the
>> classpath, which actually configures the bootsrap class loader.
>>
>> The NPE (at net.sf.saxon.Configuration line 231) comes from the line:
>> Configuration.class.getClassLoader().getResourceAsStream(sConfigFile);
>>
>> The Javadoc for #getClassLoader says that "Some implementations may use
>> null to represent the bootstrap class loader" [1]
>> see
>> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#getClassLoader()<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#getClassLoader%28%29>
>>
>> You should try using the "regular" classpath option:
>>
>> java -cp $CLASSPATH com.xmlcalabash.drivers.Main $@
>>
>> HTH,
>> Romain.
>>
>> Le 16 juin 10 à 18:30, Jostein Austvik Jacobsen a écrit :
>>
>> I'm trying to get Calabash running from a terminal, but I'm getting a
>> NullPointerException.
>>
>> To reproduce my problem on a fresh Ubuntu 10.04 installation:
>>
>> 1. Activate the "Community-maintained Open Source software
>> (universe)"-repository in *System -> Administration -> Software Sources
>> *
>> 2. Install Java
>> sudo apt-get install openjdk-6-jdk
>>
>> 3. Install Saxon
>> wget
>> http://sourceforge.net/projects/saxon/files/Saxon-HE/9.2/saxonhe9-2-1-1j.zip/download
>> unzip saxonhe9-2-1-1j.zip -d saxon9he
>> sudo mv saxon9he/saxon9he.jar /usr/share/java/
>> sudo ln --symbolic -f -T /usr/share/java/saxon9he.jar
>> /usr/share/java/saxon.jar
>>
>> 4. Install Calabash
>> wget http://xmlcalabash.com/download/calabash-0.9.21.zip
>> unzip calabash-0.9.21.zip
>> sudo mv calabash-0.9.21/lib/calabash.jar /usr/share/java/
>> gksudo gedit /usr/bin/calabash
>>
>> *---- start /usr/bin/calabash ----*
>> #!/bin/sh
>>
>> CLASSPATH=/usr/share/java/calabash.jar\
>> :/usr/share/java/saxon.jar
>> *# I also tried adding the saxon9-dom.jar included in the
>> # oXygen installation to the classpath with no success.
>> # Saxon 9.2 HE doesn't have a saxon9-dom.jar anymore.
>> *
>> java -Xbootclasspath/p:$CLASSPATH com.xmlcalabash.drivers.Main $@
>> *---- end /usr/bin/calabash ----*
>>
>> sudo chmod +x /usr/bin/calabash
>>
>> 5. Run test
>> calabash calabash-0.9.21/xpl/pipe.xpl
>>
>> java.lang.NullPointerException
>>     at net.sf.saxon.Configuration.<clinit>(Configuration.java:231)
>>     at net.sf.saxon.s9api.Processor.<init>(Processor.java:50)
>>     at
>> com.xmlcalabash.core.XProcConfiguration.<init>(XProcConfiguration.java:83)
>>     at com.xmlcalabash.drivers.Main.run(Main.java:97)
>>     at com.xmlcalabash.drivers.Main.main(Main.java:78)
>> Exception in thread "main" java.lang.ExceptionInInitializerError
>>     at net.sf.saxon.s9api.Processor.<init>(Processor.java:50)
>>     at
>> com.xmlcalabash.core.XProcConfiguration.<init>(XProcConfiguration.java:83)
>>     at com.xmlcalabash.drivers.Main.run(Main.java:97)
>>     at com.xmlcalabash.drivers.Main.main(Main.java:78)
>> Caused by: java.lang.RuntimeException: Failed to load configuration
>> defined in edition.properties
>>     at net.sf.saxon.Configuration.<clinit>(Configuration.java:277)
>>     ... 4 more
>> Caused by: java.lang.NullPointerException
>>     at net.sf.saxon.Configuration.<clinit>(Configuration.java:231)
>>     ... 4 more
>>
>>
>> Now, this looks like a problem with Saxon and/or how Calabash are using
>> it. I also suspect it might have to do with the update from Saxon 9.1 go
>> 9.2. I doubt it's a problem with Java itself, since I can run XProc scripts
>> using oXygen on the same computer. I also have the same problem using both
>> openjdk-6-jdk and sun-java6-jdk and both 32- and 64-bit Ubuntu
>> installations.
>>
>> It seems like it was solved by someone using Eclipse by "add[ing] a not
>> used jar or zip file into the library section". I'm not sure what is meant
>> by that but just for the heck of it I tried adding an empty.jar file to the
>> classpath... which did nothing:
>>
>> http://groups.google.com/group/xslt_cakupan/browse_thread/thread/f42777bd6fb5b59e
>>
>> Installing and adding Saxon-B to the classpath just made things worse, so
>> I guess that's not the way to go either.
>>
>> What am I missing? Classpath problem? Missing configuration file of some
>> sort?
>>
>> Regards
>> Jostein
>>
>>
>>
>

Received on Thursday, 17 June 2010 11:18:05 UTC