Project

Profile

Help

Build fails using AntTransform

Added by Anonymous over 16 years ago

Legacy ID: #5012578 Legacy Poster: Michael Hare (mphare)

Hi, The Ant example in the Saxon documentation uses the SchemaAware version of the processor. I don't use that so I modified the example to be: <project name="BuildNMIS" default="BuildEPORT"> <property name="Repo.dir" value="Repository"/> <property name="Impl.dir" value="Implementation/FW9500_r3.1"/> <property name="Impl.name" value="FW9500_r3.1"/> <property name="Results.dir" value="Results"/> <property name="XSLT.proc" value="C:/Programs/bin/saxon9/saxon9-ant.jar"/> <target name="build"> <taskdef name="saxon-xslt" classname="net.sf.saxon.ant.AntTransform" classpath="${XSLT.proc}"/> <saxon-xslt in="${Impl.dir}/${Impl.name}_Eport.xml" style="${Impl.dir}/${Impl.name}_Eport.xsl" out="${Results.dir}/Results_Eport.xml"> </saxon-xslt> </target> <target name="BuildEPORT" depends="build"/> </project> When I run this I get: $ ant Buildfile: build.xml build: [saxon-xslt] AntTransform.execute() schema-aware=false version 8.8 BUILD FAILED d:\mphare\NE Documents\NMIRepository\build.xml:15: java.lang.NoSuchMethodError: net.sf.saxon.Configuration.setExpandAttributeDefaults(Z)V Total time: 0 seconds Where have I gone wrong? Thanks, - mike


Replies (10)

Please register to reply

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5018280 Legacy Poster: Michael Hare (mphare)

I added the saxon9.jar to the buildfile classpath long with the saxon9-ant.jar file. No difference.

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5018519 Legacy Poster: Michael Hare (mphare)

I get an eval license for the SA processor so I could try the example directly. Here's the new ant build file: <project name="BuildNMIS" default="BuildEPORT"> <property name="Repo.dir" value="Repository"/> <property name="Impl.dir" value="Implementation/FW9500_r3.1"/> <property name="Impl.name" value="FW9500_r3.1"/> <property name="Results.dir" value="Results"/> <property name="antXSLT.proc" value="C:/Programs/bin/saxon9/saxon9-ant.jar"/> <property name="XSLT.proc" value="C:/Programs/bin/saxon9/saxon9.jar"/> <property name="saXSLT.proc" value="C:/Programs/bin/saxon9/saxonsa/saxon9sa.jar"/> <property name="saLicense.proc" value="C:/Programs/bin/saxon9/saxonsa/license"/> <target name="build"> <taskdef name="saxon-xslt" classname="net.sf.saxon.ant.AntTransform" classpath="${saXSLT.proc};${saLicense.proc}"/> <saxon-xslt in="${Impl.dir}/${Impl.name}_Eport.xml" style="${Impl.dir}/${Impl.name}_Eport.xsl" out="${Results.dir}/Results_Eport.xml" force="true" schemaaware="true" schemavalidation="strict"> </saxon-xslt> </target> <target name="BuildEPORT" depends="build"/> </project> And here's the new error message I'm getting: $ ant -f build-asaxon.xml Buildfile: build-asaxon.xml build: [saxon-xslt] AntTransform.execute() schema-aware=true version 8.8 BUILD FAILED d:\mphare\NE Documents\NMIRepository\build-asaxon.xml:21: java.lang.NoSuchMethodError: net.sf.saxon.Configuration.makeSchemaAwareCon figuration(Ljava/lang/ClassLoader;Ljava/lang/String;)Lnet/sf/saxon/Configuration; Total time: 0 seconds Am I getting closer, or further away?

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5018591 Legacy Poster: Michael Kay (mhkay)

I think you're getting closer, but there are some classpath issues here. That version="8.8" rings alarm bells - where is it picking up Saxon 8.8? Ant can be very fussy about class paths, and I often get confused by which version of Saxon is being used for what.

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5018647 Legacy Poster: Michael Hare (mphare)

Yes, now we're getting somewhere. I had saxon8 in my classpath environment variable. I pulled it out and put the non-SA stuff backinto the ant build file and it's working just fine However, for the SA version, I'm getting a complaint that saxonSA cannot find the license file. I put it in a couple of different places, now it in C:\Programs\bin\saxon9\saxonsa\license\bin\saxon-license.lic SAXON_HOME is set to C:\Programs\bin\saxon9\saxonsa\license (parent directory to bin according to the eval license email) Wan't sure what to do with Ant, so .. Ant build file is using $ ant -f build-asaxon.xml Buildfile: build-asaxon.xml build: [saxon-xslt] AntTransform.execute() schema-aware=true version 9.0.0.6 BUILD FAILED d:\mphare\NE Documents\NMIRepository\build-asaxon.xml:20: java.lang.RuntimeException: License file saxon-license.lic not found Total time: 1 second I have it working with non-SA, but since I have the eval license, I thought I'd really eval SA to see if I think I need it.

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5018686 Legacy Poster: Michael Kay (mhkay)

SAXON_HOME is used only on the .NET product. For the Java platform, the license file needs to be in a directory, and that directory needs to be on the classpath. This message invariably means that the directory containing the license file isn't on the classpath .

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5019093 Legacy Poster: Michael Hare (mphare)

Still having problems finding the license file. It's located in : C:\Programs\bin\saxon9\saxonsa My environment classpath points to that directory the Ant classpath also points to the same directory The name of the file sent me was saxon-license1.lic, when it didn't work I renamed it to saxon-license.lic as mentioned in the error message and it still didn't work. Appreciate all the help!

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5019110 Legacy Poster: Michael Kay (mhkay)

Have you tried doing a basic transformation from the command line? Something like java net.sf.saxon.Transform -sa -s:samples/data/books.xml -xsl:samples/data/books.xsl That should prove that the license file is OK; then you can start fighting the Ant classpath configuration.

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5019153 Legacy Poster: Michael Hare (mphare)

I'll try that.. BTW, do you recommend installing the SA processor over the Basic processor (same directory)?

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5026567 Legacy Poster: Michael Hare (mphare)

I must have something installed incorrectly. I get: $ java net.sf.saxon.Transform -sa s:FSS_2.0.xml -xsl:FSS_2.0.xsl java.lang.RuntimeException: java.lang.ClassNotFoundException: com.saxonica.validate.SchemaAwareConfiguration at net.sf.saxon.Configuration.makeSchemaAwareConfiguration(Configuration.java:349) at net.sf.saxon.Transform.setFactoryConfiguration(Transform.java:78) at net.sf.saxon.Transform.doTransform(Transform.java:127) at net.sf.saxon.Transform.main(Transform.java:65) Caused by: java.lang.ClassNotFoundException: com.saxonica.validate.SchemaAwareConfiguration at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at net.sf.saxon.Configuration.makeSchemaAwareConfiguration(Configuration.java:342) ... 3 more java.lang.ClassNotFoundException: com.saxonica.validate.SchemaAwareConfiguration If I run it without the -sa, it transforms just fine. I installed the SA version in the same directory as the B version. My environment classpat points to the same install directory

RE: Build fails using AntTransform - Added by Anonymous over 16 years ago

Legacy ID: #5026579 Legacy Poster: Michael Hare (mphare)

Nevermind I had the wrong jar in the environment Classpath. Works fine

    (1-10/10)

    Please register to reply