Eclipse, Tomcat, Saxon
Added by Anonymous over 17 years ago
Legacy ID: #4401193 Legacy Poster: Mike Jones (firenike)
Sorry if this is a basic question, but I just can't seem to get this to work. I'm trying to switch to Saxon in our Eclipse/Tomcat environment. We've gone to Preferences/Tomcat/JVM Settings and added the following to "Appended JVM Parameters": -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl -Djavax.xml.xpath.XPathFactory=net.sf.saxon.xpath.XPathFactoryImpl We've also added saxon8.jar to the project... Is there something we're missing? We can't seem to get it to recognize the function "tokenize()" as a test... Thanks, Mike
Replies (9)
Please register to reply
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4401239 Legacy Poster: Mike Jones (firenike)
BTW, I have also tried adding the following line to set the system property: System.setProperty("javax.xml.xpath.XPathFactory", "net.sf.saxon.xpath.XPathFactoryImpl"); But still when I create the XPathFactory and attempt to compile a statement containing "tokenize" it says it cannot find the function... Mike
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4401341 Legacy Poster: Michael Kay (mhkay)
What Saxon version are you using? There was a problem with 8.9 as first issued (the services metadata in the Jar files was incorrect, because of a bug in Ant). Subsequent maintenance releases fixed that. To be honest, if your XSLT/XPath code depends on Saxon, then you may be best off not relying on the JAXP classpath search mechanism, and instead invoke Saxon explicitly from your application. Apart from the JAXP factory mechanism being rather sensitive to changes in your configuration, it's also very slow.
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4408592 Legacy Poster: Mike Jones (firenike)
Hi- Thanks, that fixed it! However, I have a new problem- is there any reason that saxon:sort() cannot be found by my system? saxon:evaluate() and saxon:expression() both work. The validator says that a 2 argument function by the name of sort does not exist. I've tried everything I can think of to no avail. Mike
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4408600 Legacy Poster: Michael Kay (mhkay)
saxon:evaluate() and saxon:expression() are "known to the system" whereas saxon:sort() is loaded in the same way as user extension functions by dynamic loading from the classpath. That doesn't explain why it fails but it explains why they are different. Eclipse has a pretty peculiar classloader setup so dynamic loading is often problematic. Unfortunately I'm not an Eclipse user so I can't help you that much. Try setting configuration.setTraceExternalFunctions(true) to see if that sheds any light. If it is a classloader issue, calling configuration.setClassLoader() might fix it - but I don't know what ClassLoader you would supply as the argument.
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4410643 Legacy Poster: Mike Jones (firenike)
Thanks, Mike, for pointing me in that direction. Looks like you have to tell Oxygen where the extension jars are located. Oxygen 8.1 is pre-configured for Saxon extension jars, but the Saxon jars are old- 8.1... so functions like sort are not in there. To fix it, you just have to copy the latest Saxon jars into eclipse/plugins/oxygen/plugin/lib and restart eclipse with the -clean option once. Otherwise, if that doesn't work, try this for more information: http://www.oxygenxml.com/doc/ug-eclipse/configuring-XSLT-processor-extensions-paths.html
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4411118 Legacy Poster: Michael Kay (mhkay)
Thanks for the info. Might be useful to add this to the Wiki. I think oXygen 8.2 bundles Saxon 8.9.0.3: http://www.oxygenxml.com/history.html#8.2
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4413101 Legacy Poster: Mike Jones (firenike)
Sounds good- I seeded a FAQ and Troubleshooting guide at the following URL: http://saxon.wiki.sourceforge.net/FAQ Mike
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4414662 Legacy Poster: Mike Jones (firenike)
OK, so from the newbie perspective I added to the wiki everything that is needed to configure saxon on eclipse and/or oxygen. I tried to add it in a format that fits with the rest of the site instead of the FAQ format... I have everything working now, but there is a little nagging problem... wonder if anyone has any idea what could explain the following (I will also follow up with Oxygen): Given the large teacher/class file above, I transformed with the following scenarios and times to completion: (1) 30 s: On the Oxygen bench using the XPath toolbar. It appears from the documentation that the XPath toolbar is hardcoded to use Saxon8B. (2) 400 ms: On the Oxygen bench using an XSLT transform specifying Saxon8B. (3) 30 ms: On the Oxygen bench using an XSLT transform specifying Saxon8SA. (4) 30 s: Running an eclipse transformation using Saxon8B. (5) < 1s: Running an eclipse transformation using Saxon8SA. The scenario that doesn't make sense to me is #2. Shouldn't it be 30 s instead of 400 ms? In each case I have verified the version of Saxon by including a call to system properties on "vendor" and "schema-aware" (except for the case of the XPath toolbar, which does not support system-properties(), but I did read in the Oxygen documentation that Saxon8B is used). Anyway, no big deal, just weird... maybe they are actually using 8SA and somehow turning off the schema-aware functionality... but that wouldn't explain the 400 ms versus the 30 ms...
RE: Eclipse, Tomcat, Saxon - Added by Anonymous over 17 years ago
Legacy ID: #4414689 Legacy Poster: Michael Kay (mhkay)
Interesting numbers. I'm afraid I can't shed any light on that 400ms figure; I would have to set up my own testbench and examine what's going on internally. Thanks for adding to the Wiki. You might like to link to your info from the entry under oXygen under "Related products". Michael Kay
Please register to reply