Project

Profile

Help

saxon_home being ignored with 9.3 .net versio

Added by Anonymous over 12 years ago

Legacy ID: #10777444 Legacy Poster: Tobias Klevenz ()

Hi Michael, we build a simple .net class for a client that invokes a transformation and shows a MessageBox in case of an error. The class is loaded in a powershell script. In the class we add a reference to saxon9pe-api.dll and IKVM.OpenJDK.Core.dll. The saxon-license.lic is in the same folder as the referenced dlls the saxon_home environment variable is set as described by you: [quote]FOR THE .NET PLATFORM: Please save the license file in the xxxx/bin directory containing the Saxon software, and set the SAXON_HOME environment variable to the parent directory xxxx.[/quote] Now if we use Saxon 9.2 the licence file is found using SAXON_HOME, but when we try to invoke the transformation from within powershell we get a the following error: [b]The type initializer for 'net.sf.saxon.Configuration' threw an exception.[/b] Which I guess was fixed in 9.3 If we use Saxon 9.3 however SAXON_HOME seems to be completely ignored, the licence file is only found when it is in [b]C:\Program Files\Saxonica\SaxonPE9.3N\bin[/b]. However for the client the people managing the Server are not the same people who manage the application that will call saxon, so having a "portable" saxon that doesn't have to be installed to c: would be prefered. Also it is just us testing with PE, the client bought EE licences as far as I know, in case this makes any different. Thanks, Tobias


Replies (14)

Please register to reply

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

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

I recently spotted that the instructions being sent out with new license keys needed updating, and this should have been done. You're right that SAXON_HOME is no longer relevant. On .NET in 9.3, Saxon should be installed using the supplied installation wizard. This creates a registry key, which identifies the location of the installed software. The license file should then be copied to the /bin subdirectory of this installation directory. We had a bug report recently from a user who found that this mechanism wasn't working on 64-bit systems because Windows aliases the registry entries (it maps the name you ask for to some other name, and this aliasing was kicking in when we write to the registry and not when we read from it). We've done a build that fixes this problem, which we can make available if needed - it wasn't publicly announced because we didn't run full regression tests on it, and were dependent on the customer to check that the fix actually works.

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10777946 Legacy Poster: Tobias Klevenz ()

Ok, so installing saxon using the installer is the only option to get the licensed saxon working, and a "portable installation" is not possible? This was actually my main issue. I don't have any issue using the installer on a 64bit System, so your build is not needed.

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

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

I'm not entirely sure what you mean by a "portable installation". You can of course choose where the installer does the installation. If you know what you're doing, you could also bypass the wizard and set the relevant registry keys yourself. Or (especially if you are installing Saxon as part of an application) you could fall back to one of the other mechanisms used by Saxon to locate the license file, for example setting the configuration property FeatureKeys.LICENSE_FILE_LOCATION.

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10784616 Legacy Poster: tg (pilger81)

Hi Michael, we cant install saxon via the wizard because our customer wants to copy the files manually without an installer. so thank you for the hint using the FeatureKeys.LICENSE_FILE_LOCATION property. well I tried to implement this but unfortunately it doesnt seem to work. here is the code I am using: processor.SetProperty("http://saxon.sf.net/feature/licenseFileLocation", licensefile); licensefile is a string with the location of the "saxon-license.lic" file in the filesystem. and It looks like saxon is finding it, because when we change the path in licensefile to a wrong location - an exception is thrown saying something like "cant find the license file". when the path is correct - nothing happens. so I guess he found it. but when we start a transformation using "next in chain" for example, the exception says that this feature is not supported with saxon HE... do you have a hint what I could do? Im a bit out of ideas right now :) greetings

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

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

It looks as if you are running the transformation using the Saxon-HE code paths, despite the fact that you have activated Saxon-EE. I would need to see how you are running the transformation. There's something odd going on; it looks as if you have an EE configuration for loading the license file, and an HE configuration for running the transformation. Perhaps there is more than one Configuration object around.

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10790258 Legacy Poster: tg (pilger81)

Hi Michael, this is how we basically run the transformation: [code] private bool work(string doc, string xsltfile, string target) { Processor processor = new Processor(true); processor.SetProperty("http://saxon.sf.net/feature/licenseFileLocation", Saxon_Home); XdmNode input = processor.NewDocumentBuilder().Build(new Uri(doc)); XsltCompiler compiler = processor.NewXsltCompiler(); XsltTransformer xslttransformer = compiler.Compile(new Uri(xsltfile)).Load(); xslttransformer.InitialContextNode = input; // Create a serializer FileStream ziel = new FileStream(target, FileMode.Create, FileAccess.Write); serializer.SetOutputStream(ziel); // Transform the source XML xslttransformer.Run(serializer); // Close the filestream ziel.Close(); ... [/code] In the references area of the project we linked (like my colleague already said) saxon9pe-api.dll and the IKVM.OpenJDK.Core. And we already tried that with the EE dlls. But with the same result. Greetings

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10790262 Legacy Poster: tg (pilger81)

the semicolon in [code]processor.SetProperty("http://saxon.sf.net/feature/licenseFileLocation";, Saxon_Home); [/code] comes with the copy & paste.

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10808845 Legacy Poster: Tobias Klevenz ()

[quote]you could fall back to one of the other mechanisms used by Saxon to locate the license file, for example setting the configuration property FeatureKeys.LICENSE_FILE_LOCATION.[/quote] What other methods are there to locate the license file that we could try. Thanks, Tobias

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10831229 Legacy Poster: Tobias Klevenz ()

Hey Michael, is there any update on this? Did we find a bug here or is the error on our site? Sorry to press you, but we are aproaching a deadline with our client on this. Do you think there could be an issue with our liscence file? We are trying it with a PE liscence, our client recently bought 4 EE Site liscences if you think it would work with the EE I could try it with one of those. Regards, Tobias

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

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

Could I suggest you start by installing the 9.3.0.11 maintenance release, using the installation wizard. This fixes the bug that was found in reading the registry on 64-bit systems. First try running something that needs a license from the command line; then try your application. If it doesn't work, please tell me exactly what you did and exactly what errors you got. The detailed error message is important even if it appears uninformative. Also please run with the -t option on the command line, or with the configuration property "http://saxon.sf.net/feature/timing" set to "true" to maximize the diagnostics available; and either ensure that you capture the standard error output, if necessary by redirecting it to a file by setting the configuration property "http://saxon.sf.net/feature/standardErrorOutputFile" to the name of the file. It might also be useful to display the class name of the object returned by Processor.Implementation property, to check that you are in fact loading Saxon-PE or Saxon-EE software.

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10831520 Legacy Poster: tg (pilger81)

Hi Michael, as we said the main problem here is, that we need saxon to work without installing it via the wizard. however I downloaded 9.3.0.11 and implemented its dlls into the project. Unfortunatly the result is the same. In the debugger when I look into the implementation property I see softwareEdition = "PE". This is what we get with time set to true: [code]Failed unexpectedly: Failed to compile stylesheet. 1 error detected.Serialization parameter {{http://saxon.sf.net/}next-in-...} is not available in Saxon-HE Tree size: 218721 nodes, 1215652 characters, 12541 attributes[/code] And this is what the standard error output says when saxon is installed with the wizard. The licence file is not in the bin directory in Program Files instead we referenced the licence file via the "http://saxon.sf.net/feature/licenseFileLocation" Property to a different location in the file system: [code] Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser Found registry key at HKEY_LOCAL_MACHINE\Software\Wow6432Node\Saxonica\SaxonPE-N\Settings Software installation path: c:\Program Files\Saxonica\SaxonPE9.3N License file saxon-license.lic not found. Tried in file:/C:/Windows/assembly/GAC_MSIL/saxon9pe/9.3.0.11__e1fdd002d5083fe6/saxon9pe.dll/saxon-license-lic, c:\Program Files\Saxonica\SaxonPE9.3N/bin/saxon-license.lic, c:\Program Files\Saxonica\SaxonPE9.3N/saxon-license.lic, classpath, . Running with licensable features disabled Building tree for file:///C:/Users/Tobias J. Goertz/Documents/Visual Studio 2010/Projects/XsltTransform/XsltTransformer/testfiles/in/P2000190.xml using class net.sf.saxon.tree.tiny.TinyBuilder Tree built in 234 milliseconds [/code] This is what the error looks like when we dont have Saxon installed and copied the files manually to a custom location. Also the licence-file is set here via "http://saxon.sf.net/feature/licenseFileLocation". This is what we actually need to achieve: [code] Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser License file saxon-license.lic not found. Tried in file:/C:/Windows/assembly/GAC_MSIL/saxon9pe/9.3.0.11__e1fdd002d5083fe6/saxon9pe.dll/saxon-license-lic, classpath, . Running with licensable features disabled Building tree for file:///C:/Users/Tobias J. Goertz/Documents/Visual Studio 2010/Projects/XsltTransform/XsltTransformer/testfiles/in/P2000190.xml using class net.sf.saxon.tree.tiny.TinyBuilder Tree built in 390 milliseconds[/code] When Saxon is installed via wizard, and the licence-file is put into its bin directory - everything works fine. But that not what we need in this case. We must be able to copy it where we want without registry settings. I guess that "http://saxon.sf.net/feature/licenseFileLocation" is ignored in some way. Thank you

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

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

I think that what is happening here is that the call to set the license file location successfully finds and reads the license file, but doesn't record the fact that it has done so in all the right places, which means that a subsequent request for license verification tries again to find the license using the registry key. In our testing this would have succeeded because the registry key happened to be set correctly. I'll attempt a fix. However, a cleaner workaround might be if you write a little script that sets the registry key to the required value.

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10831855 Legacy Poster: Tobias Klevenz ()

Hi Michael thanks for your answer, [b]HKEY_LOCAL_MACHINE\Software\Wow6432Node\Saxonica\SaxonPE-N\Settings Software installation[/b] is the Registry Key we need to set right? If so I don't think we can do it because you can't write to HKEY_LOCAL_MACHINE as a normal User. Is there an equivalent path on HKEY_CURRENT_USER? On the clients server we don't have admin rights, that's why we can't use Saxon with the installer to begin with. -Tobias

RE: saxon_home being ignored with 9.3 .net versio - Added by Anonymous over 12 years ago

Legacy ID: #10854543 Legacy Poster: Tobias Klevenz ()

...so I guess not?

    (1-14/14)

    Please register to reply