Project

Profile

Help

Bug #4759

closed

Saxon.NET: InvalidCastException in sun.net.ftp.impl.FtpClient (Missing IKVM DLL from build)

Added by Emanuel Wlaschitz over 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
.NET API
Sprint/Milestone:
-
Start date:
2020-09-28
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 9.9
Fix Committed on Branch:
10
Fixed in Maintenance Release:
Platforms:

Description

We got Saxon-HE 9.9.1.2 integrated in one of our tools, and it seems to fail on one particular machine every so often with the following error:

System.TypeInitializationException: The type initializer for 'sun.net.ftp.impl.FtpClient' threw an exception. ---> System.InvalidCastException: Unable to cast object of type 'java.util.PropertyResourceBundle' to type 'sun.util.resources.OpenListResourceBundle'.
   at sun.util.resources.LocaleData.getCurrencyNames(Locale locale)
   at sun.util.locale.provider.LocaleResources.getCurrencyName(String key)
   at sun.util.locale.provider.CurrencyNameProviderImpl.getString(String , Locale )
   at sun.util.locale.provider.CurrencyNameProviderImpl.getSymbol(String currencyCode, Locale locale)
   at java.util.Currency.CurrencyNameGetter.getObject(CurrencyNameProvider , Locale , String , Object[] )
   at java.util.Currency.CurrencyNameGetter.getObject(LocaleServiceProvider , Locale , String , Object[] )
   at sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObjectImpl(LocalizedObjectGetter , Locale , Boolean , String , Object[] )
   at sun.util.locale.provider.LocaleServiceProviderPool.getLocalizedObject(LocalizedObjectGetter getter, Locale locale, String key, Object[] params)
   at java.util.Currency.getSymbol(Locale locale)
   at java.text.DecimalFormatSymbols.initialize(Locale )
   at java.text.DecimalFormatSymbols..ctor(Locale locale)
   at sun.util.locale.provider.DecimalFormatSymbolsProviderImpl.getInstance(Locale locale)
   at java.text.DecimalFormatSymbols.getInstance(Locale locale)
   at sun.util.locale.provider.NumberFormatProviderImpl.getInstance(Locale , Int32 )
   at sun.util.locale.provider.NumberFormatProviderImpl.getIntegerInstance(Locale locale)
   at java.text.NumberFormat.getInstance(LocaleProviderAdapter , Locale , Int32 )
   at java.text.NumberFormat.getInstance(Locale , Int32 )
   at java.text.NumberFormat.getIntegerInstance(Locale inLocale)
   at java.text.SimpleDateFormat.initialize(Locale )
   at java.text.SimpleDateFormat..ctor(String pattern, Locale locale)
   at java.text.SimpleDateFormat..ctor(String pattern)
   at sun.net.ftp.impl.FtpClient..cctor()
   --- End of inner exception stack trace ---
   at sun.net.ftp.impl.FtpClient.create()
   at sun.net.ftp.impl.DefaultFtpClientProvider.createFtpClient()
   at sun.net.ftp.FtpClient.create()
   at sun.net.www.protocol.ftp.FtpURLConnection.connect()
   at net.sf.saxon.lib.StandardUnparsedTextResolver.resolve(URI absoluteURI, String encoding, Configuration config)
   at net.sf.saxon.functions.UnparsedTextFunction.readFile(URI absoluteURI, String encoding, XPathContext context)
   at net.sf.saxon.functions.UnparsedText.evalUnparsedText(StringValue hrefVal, String base, String encoding, XPathContext context)
   at net.sf.saxon.functions.UnparsedTextAvailable.evalUnparsedTextAvailable(StringValue hrefVal, String encoding, XPathContext context)
   at net.sf.saxon.functions.UnparsedTextAvailable.call(XPathContext context, Sequence[] arguments)
   at net.sf.saxon.functions.UnparsedTextAvailable.call(XPathContext xpc, Sequence[] sarr)
   at net.sf.saxon.expr.FunctionCall.iterate(XPathContext context)
   at net.sf.saxon.expr.Expression.effectiveBooleanValue(XPathContext context)
   at net.sf.saxon.expr.AndExpression.effectiveBooleanValue(XPathContext c)
   at net.sf.saxon.expr.AndExpression.effectiveBooleanValue(XPathContext c)
   at net.sf.saxon.expr.AndExpression.effectiveBooleanValue(XPathContext c)
   at net.sf.saxon.expr.AndExpression.effectiveBooleanValue(XPathContext c)
   at net.sf.saxon.expr.instruct.Choose.choose(XPathContext )
   at net.sf.saxon.expr.instruct.Choose.processLeavingTail(XPathContext context)
   at net.sf.saxon.expr.instruct.Block.processLeavingTail(XPathContext context)
   at net.sf.saxon.expr.instruct.Instruction.process(XPathContext context)
   at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(XPathContext context, NodeInfo copiedNode)
   at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(XPathContext context)
   at net.sf.saxon.expr.instruct.Block.processLeavingTail(XPathContext context)
   at net.sf.saxon.expr.instruct.Instruction.process(XPathContext context)
   at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(XPathContext context, NodeInfo copiedNode)
   at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(XPathContext context)
   at net.sf.saxon.expr.instruct.Block.processLeavingTail(XPathContext context)
   at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(XPathContext context)
   at net.sf.saxon.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, XPathContextMajor context, Location locationId)
   at net.sf.saxon.expr.instruct.ApplyTemplates.ApplyTemplatesPackage.processLeavingTail()
   at net.sf.saxon.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, XPathContextMajor context, Location locationId)
   at net.sf.saxon.expr.instruct.ApplyTemplates.ApplyTemplatesPackage.processLeavingTail()
   at net.sf.saxon.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, XPathContextMajor context, Location locationId)
   at net.sf.saxon.trans.XsltController.applyTemplates(Sequence source, Receiver out)
   at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(Source , Receiver )
   at net.sf.saxon.s9api.XsltTransformer.transform()
   at Saxon.Api.XsltTransformer.Run(XmlDestination destination)
   at [our own code calling XsltTransformer.Run]

Other machines appear to be fine, otherwise we'd have found this sooner.

Searching for this gives little to no applicable Saxon-related results, and searching outside Saxon brings at least this report on GitHub which indicates there might be IKVM.OpenJDK.Cldrdata.dll missing in the application directory. We randomly tried that, but that machine is on an English OS so it shouldn't apply.

By testing, it seems we at least need IKVM.OpenJDK.Localedata.dll in there (either as well, or just instead of Cldrdata) - but we don't have any more info than that (since we're still trying to narrow it down a lot).

Neither of those files is part of the Saxon-HE distribution at this point, which is a bit surprising (not just because it has worked before; and we've been on Saxon-HE 9.9.1.2 since March while we've only seen those issues pop up recently, since last month or so).

The XSLT seems innocent as well, the only call it makes that seems remotely relevant in the context of the stacktrace above is a check for bundling files (which then emits different <style>/<script> tags):

<xsl:choose>
  <xsl:when test="not($disableBundles) and unparsed-text-available('bundling/vendor.min.css') and unparsed-text-available('bundling/vendor.min.js')">
    <!-- use bundled files -->
  </xsl:when>
  <xsl:otherwise>
    <!-- use regular files -->
  </xsl:otherwise>
</xsl:choose>

The calling code seems pretty straight-forward as well; the only noteworthy things there are the fact that we load an XML file into System.Xml.Linq.XDocument; often from a UNC path (which may or may not be on the same machine), and then use XDocument.CreateReader() to create the input for XsltTransformer.InitialContextNode (using DocumentBuilder.Build(xmlReader)) while the stylesheet is always local (and loaded using XsltCompiler.Compile(File.OpenRead(stylesheetPath))).

Other than that, we're having a lot of issues trying to narrow it down and creating a minimal repro case; mainly because it only happens on that one machine and not consistently enough to call it "reproducible".

Any thoughts and hints would be appreciated on how to proceed further; since copying random DLL files into the application folder seems a bit weird way of getting things to work (especially since we're apparently the first ones that see this).

Please register to edit this issue

Also available in: Atom PDF