Problems with executing a ODBC-connect-xslt via command line
Added by Yann Vandercoilden over 8 years ago
Hello!
I just begin with an apology, as I am a complete newbie in xslt and saxon.
In the company where I work, our XSLT-pro quit and I have now to maintain and continue his work. I also got his Oxygen XML Developer License.
Now I tried to make a small xslt to query a simple "SELECT" on and SQL-Database, connection via ODBC. When I start transformation in Oxygen, everything works really fine. As in production environement, everything works on command line, I wanted to execute it also that way, but there I have some trouble.
Here are my files:
First the config file for saxon "saxon.txt":
Then here is the xslt "odbc.xslt":
SQL extensions are not installed
sql:connect is not available
Now I try to start it in command line:
java -cp C:\Dev\Konverter_2-10\saxonpe9-4-0-3J\saxon9-sql.jar: net.sf.saxon.Transform -config:C:\Dev\Konverter_2-10\saxon.txt -s:C:\Dev\Konverter_2-10\odbc.xml -xsl:C:\Dev\Konverter_2-10\odbc.xsl -o:C:\Dev\Konverter_2-10\odbc_out.xml >> C:\Dev\Konverter_2-10\odbc.log 2>&1
Unfortunately, the log shows following message:
Fehler: Hauptklasse net.sf.saxon.Transform konnte nicht gefunden oder geladen werden
Translated, it tells me, that the main class "net.sf.saxon.Transform" could not be found or loaded.
Does anyone have a hint, what I could check to find my problem? I think some files are missing, but as I cannot really see how Oxygen XML executes the command in background, I don't have any reference :-(
Kind regards Yann
Replies (3)
Please register to reply
RE: Problems with executing a ODBC-connect-xslt via command line - Added by Michael Kay over 8 years ago
This error simply means that you don't have the right JAR files after the "-cp" option. (Note that a non-existent file listed here is simply and silently ignored). You need both the saxon9pe.jar and the saxon9-sql.jar, and since you're on Windows, the list should be separated by semicolons.
RE: Problems with executing a ODBC-connect-xslt via command line - Added by Yann Vandercoilden over 8 years ago
Hello Michael
Thank you for that quick reply.
I now executed the command with both jar-files included:
java -cp C:\Dev\Konverter_2-10\saxonpe9-4-0-3J\saxon9pe.jar;C:\Dev\Konverter_2-10\saxonpe9-4-0-3J\saxon9-sql.jar net.sf.saxon.Transform -config:C:\Dev\Konverter_2-10\saxon.txt -s:C:\Dev\Konverter_2-10\odbc.xml -xsl:C:\Dev\Konverter_2-10\odbc.xsl -o:C:\Dev\Konverter_2-10\odbc_out.xml >> C:\Dev\Konverter_2-10\odbc.log 2>&1
I get some java errors:
Exception in thread "main" java.lang.VerifyError: class net.sf.saxon.option.sql.SQLConnect$ConnectInstruction overrides final method evaluateItem.(Lnet/sf/saxon/expr/XPathContext;)Lnet/sf/saxon/om/Item;
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.saxonica.xsltextn.StyleNodeFactoryPE.makeElementNode(StyleNodeFactoryPE.java:116)
at net.sf.saxon.tree.linked.LinkedTreeBuilder.startContent(LinkedTreeBuilder.java:227)
at net.sf.saxon.style.UseWhenFilter.startContent(UseWhenFilter.java:183)
at net.sf.saxon.event.StartTagBuffer.startContent(StartTagBuffer.java:226)
at net.sf.saxon.event.ProxyReceiver.startContent(ProxyReceiver.java:170)
at net.sf.saxon.event.ProxyReceiver.startContent(ProxyReceiver.java:170)
at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:344)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:405)
at net.sf.saxon.event.Sender.send(Sender.java:178)
at net.sf.saxon.PreparedStylesheet.loadStylesheetModule(PreparedStylesheet.java:274)
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:206)
at net.sf.saxon.PreparedStylesheet.compile(PreparedStylesheet.java:106)
at net.sf.saxon.Transform.doTransform(Transform.java:559)
at net.sf.saxon.Transform.main(Transform.java:73)
I don't know if these messages have something to do with the saxon-files I am using or the installed Java-Version. Oxygen has it's own jre-directory, so there it may use this one instead of the system wide jre.
As "unknown source" is mentioned many times, there must be something missing, but I cannot figure out what it is :(
Kind regards Yann
RE: Problems with executing a ODBC-connect-xslt via command line - Added by Michael Kay over 8 years ago
That's a very strange one, complicated by the fact that you are using a very old release.
The SQLConnect.ConnectInstruction class in Saxon 9.4 does not have an evaluateItem() method, so I think the JAR file you are using is from a different release; I would strongly suspect that the two JAR files you are using are from different Saxon releases, and therefore incompatible with each other.
The SQLConnect.ConnectInstruction class did have an evaluateItem() method in Saxon 9.3.
Please register to reply