Re: Running Calabash from a terminal (Linux)

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()

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 Wednesday, 16 June 2010 19:17:07 UTC