W3C home > Mailing lists > Public > xproc-dev@w3.org > July 2011

Trouble configuring custom extension in xmlcalabash

From: Geert Josten <geert.josten@daidalos.nl>
Date: Wed, 20 Jul 2011 23:13:34 +0200
To: "XProc Dev (xproc-dev@w3.org)" <xproc-dev@w3.org>
Message-ID: <B26C615F8546A84C81165A7BC8BE61A020F39D7D10@EXMBXC01.ms-hosting.nl>
Hi,

I have trouble configuring a custom extension in xmlcalabash. Is the following a known issue?

I was looking at a way of reading out java.home. The pos:env seemed to get me pretty close, but is quite literally returning environment variables. It is using System.getenv() under the hood, while I am looking for something that returns all of System.getProperties(). So I though, let me just copy the Env class, patch it, and add it as an extension of my own. The signature is the same. I put it in a jar, added it to the java classpath, and passed in a configuration xml that associates my step type with the new class. Xmlcalabash however crashes with the following exception:

java.lang.UnsupportedOperationException: Class not found: nl.grtjn.xproc.util.osutils.Env
        at com.xmlcalabash.runtime.XAtomicStep.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.doRun(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipelineCall.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.doRun(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipelineCall.run(Unknown Source)
        at com.xmlcalabash.runtime.XCompoundStep.run(Unknown Source)
        at com.xmlcalabash.runtime.XChoose.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.doRun(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipelineCall.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.doRun(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipelineCall.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.doRun(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipelineCall.run(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.doRun(Unknown Source)
        at com.xmlcalabash.runtime.XPipeline.run(Unknown Source)
        at com.xmlcalabash.drivers.Main.run(Unknown Source)
        at com.xmlcalabash.drivers.Main.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: nl.grtjn.xproc.util.osutils.Env
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        ... 22 more

Fun fact here is that if I inject my class into calabash.jar itself, it runs just fine. So, sounds like a classloader issue.

Is this a known bug? Should I do something special to make xmlcalabash see other jars on the classpath, apart from its own?

I could have filed it as a new issue, but wanted to ask here first..

Kind regards,
Geert
Received on Wednesday, 20 July 2011 21:13:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 20 July 2011 21:13:57 GMT