Discussion:
[oXygen-user] Problems in Ant transform, xslt task and manually specified TransformerFactory
Jirka Kosek
2011-08-07 22:21:09 UTC
Permalink
Hi,

I have Ant build file which works perfectly outside oXygen. For various
reasons both Saxon9 and Saxon6 has to be called during the build
process, so xslt task always specifies which transformer to use using
factory:

<xslt ...>
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute name="http://saxon.sf.net/feature/xinclude-aware"
value="true"/>
</factory>
<classpath location="${saxon9.jar}"/>
</xslt>

or

<xslt ...>
<factory name="com.icl.saxon.TransformerFactoryImpl"/>
<classpath>
<pathelement location="${saxon.jar}"/>
</classpath>
</xslt>

Problem is that in oXygen (12.2, Windows/Linux) such Ant task produces
the following error message:

BUILD FAILED
.....\build.xml:126: java.lang.ClassNotFoundException:
com.icl.saxon.TransformerFactoryImpl

I suppose that's because oXygen uses special classloader. Do you have
any idea how to overcome this issue? I need to run same Ant script from
oXygen and standalone as well.

Thanks,

Jirka
--
------------------------------------------------------------------
Jirka Kosek e-mail: ***@kosek.cz http://xmlguru.cz
------------------------------------------------------------------
Professional XML consulting and training services
DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------
Radu Coravu
2011-08-08 06:06:10 UTC
Permalink
Hi Jirka,

The ANT process started by Oxygen for an ANT transformation scenario is
a separate process and does not use the Oxygen available libraries or
class loaders.

But if you edit the ANT transformation scenario, in the "Options" tab
you have a "Libraries" button which you can use to add additional
libraries to the started process class path. You can add for example the
Saxon 6 libraries which come in the Oxygen installation "lib "directory.

In your case I also see you have a classpath reference in the <xslt>
Post by Jirka Kosek
<classpath location="${saxon9.jar}"/>
In the ANT scenario edit dialog, in the "Parameters" tab did you set a
value for the "saxon9.jar" parameter name?

Regards,
Radu

Radu Coravu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post by Jirka Kosek
Hi,
I have Ant build file which works perfectly outside oXygen. For various
reasons both Saxon9 and Saxon6 has to be called during the build
process, so xslt task always specifies which transformer to use using
<xslt ...>
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute name="http://saxon.sf.net/feature/xinclude-aware"
value="true"/>
</factory>
<classpath location="${saxon9.jar}"/>
</xslt>
or
<xslt ...>
<factory name="com.icl.saxon.TransformerFactoryImpl"/>
<classpath>
<pathelement location="${saxon.jar}"/>
</classpath>
</xslt>
Problem is that in oXygen (12.2, Windows/Linux) such Ant task produces
BUILD FAILED
com.icl.saxon.TransformerFactoryImpl
I suppose that's because oXygen uses special classloader. Do you have
any idea how to overcome this issue? I need to run same Ant script from
oXygen and standalone as well.
Thanks,
Jirka
_______________________________________________
oXygen-user mailing list
http://www.oxygenxml.com/mailman/listinfo/oxygen-user
Jirka Kosek
2011-08-11 15:04:57 UTC
Permalink
Post by Radu Coravu
The ANT process started by Oxygen for an ANT transformation scenario is
a separate process and does not use the Oxygen available libraries or
class loaders.
I see, but there are still some strange things happening because Ant run
from oXygen behaves slightly differently then when invoked from
command-line. But I'm using standalone ant from command line, not one
bundled with oXygen (but same version 1.8.2).
Post by Radu Coravu
But if you edit the ANT transformation scenario, in the "Options" tab
you have a "Libraries" button which you can use to add additional
libraries to the started process class path. You can add for example the
Saxon 6 libraries which come in the Oxygen installation "lib "directory.
Thanks, I was hoping that it will be possible to make it work without
it. But adding libraries this way solved problem.
Post by Radu Coravu
In your case I also see you have a classpath reference in the <xslt>
Post by Jirka Kosek
<classpath location="${saxon9.jar}"/>
In the ANT scenario edit dialog, in the "Parameters" tab did you set a
value for the "saxon9.jar" parameter name?
Sure, I was just extracting snippet from more complex build.xml.
Property is correctly set.

Anyway thanks,

Jirka
--
------------------------------------------------------------------
Jirka Kosek e-mail: ***@kosek.cz http://www.kosek.cz
------------------------------------------------------------------
Profesionální školení a poradenství v oblasti technologií XML.
PodrobnÜ přehled Å¡kolení http://xmlguru.cz/skoleni/
------------------------------------------------------------------
http://docbook.cz Stránky o dokumentačním formátu DocBook
http://xmlguru.cz Blog mostly about XML for English readers
------------------------------------------------------------------
Radu Coravu
2011-08-15 07:18:30 UTC
Permalink
Hi Jirka,

Basically the "ant.bat" usually has some class paths and parameters
specified before starting the ANT process.
As the Oxygen ANT transformation scenario starts the Java process
directly all these settings need somehow to be added as options to the
ANT scenario.

So yes, there are differences, Oxygen does not start ANT by invoking the
"ant.bat" executable.

Regards,
Radu

Radu Coravu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post by Jirka Kosek
Post by Radu Coravu
The ANT process started by Oxygen for an ANT transformation scenario is
a separate process and does not use the Oxygen available libraries or
class loaders.
I see, but there are still some strange things happening because Ant run
from oXygen behaves slightly differently then when invoked from
command-line. But I'm using standalone ant from command line, not one
bundled with oXygen (but same version 1.8.2).
Post by Radu Coravu
But if you edit the ANT transformation scenario, in the "Options" tab
you have a "Libraries" button which you can use to add additional
libraries to the started process class path. You can add for example the
Saxon 6 libraries which come in the Oxygen installation "lib "directory.
Thanks, I was hoping that it will be possible to make it work without
it. But adding libraries this way solved problem.
Post by Radu Coravu
In your case I also see you have a classpath reference in the<xslt>
Post by Jirka Kosek
<classpath location="${saxon9.jar}"/>
In the ANT scenario edit dialog, in the "Parameters" tab did you set a
value for the "saxon9.jar" parameter name?
Sure, I was just extracting snippet from more complex build.xml.
Property is correctly set.
Anyway thanks,
Jirka
_______________________________________________
oXygen-user mailing list
http://www.oxygenxml.com/mailman/listinfo/oxygen-user
Loading...