What is baffling to us is that the same web application that is failing on this one IIS server works fine on another server. Because of this, the problem seems environment related, and not code related. I was wondering if someone who understood the stack trace better than I might be able to identify some machine setting or permissions, or something that might lead us down the right path. At this point, it's a big unknown for us. 

Both the web application and the windows app are framework 4.0. Saxon9.dll and Saxon9api.dll versions are 9.1.0.2.



From: Michael Kay <mike@saxonica.com>
To: saxon-help@lists.sourceforge.net
Sent: Friday, September 14, 2012 11:52:31 AM
Subject: Re: [saxon] Exception launching Saxon from .NET web application but not from windows application on same machine


This one is going to be tough. I can't see an obvious way forward on it; we need to isolate what property of the execution environment is responsible for the failure.

Which version of Saxon, and which version of .NET? I think we've encountered some problems recently with running the bytecode generation in Saxon-EE 9.4 under .NET 4.0, but this seems to be Saxon-HE so byte code generation isn't involved.

Michael Kay
Saxonica

On 14/09/2012 15:35, Jason Beal wrote:

One particular IIS server we have for in-house testing is failing to instantiate a Saxon processor object. Other IIS servers we have deployed the web application on work fine. 

I created a basic web app to instantiate the processor with the following code behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Write("Trying to instantiate SaxonProcessor...")
    Try
        Dim SaxonProcessor As Saxon.Api.Processor = New Saxon.Api.Processor()
        Response.Write("Saxon instantiated successfully!")
    Catch
 ex As Exception
        Response.Write("Error: " & ex.Message & ex.StackTrace)
    End Try
End Sub
 
This is the exception that I get when the page loads:
 
Trying to instantiate SaxonProcessor...
System.TypeInitializationException: The type initializer for 'IKVM.NativeCode.java.lang.Thread' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'java.io.BufferedInputStream' threw an exception. ---> java.lang.RuntimeException: java.lang.IllegalAccessException: Class java.util.concurrent.atomic.AtomicReferenceFieldUpdater can not access a member of class java.io.BufferedInputStream with modifiers "volatile" ---> java.lang.IllegalAccessException: Class java.util.concurrent.atomic.AtomicReferenceFieldUpdater can not access a member of class java.io.BufferedInputStream with modifiers "volatile" at sun.reflect.misc.ReflectUtil.ensureMemberAccess(Class currentClass, Class memberClass, Object target, Int32 modifiers) at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.AtomicReferenceFieldUpdaterImpl..ctor(Class , Class , String ) --- End of inner exception stack trace --- at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.AtomicReferenceFieldUpdaterImpl..ctor(Class , Class , String ) at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(Class tclass, Class vclass, String fieldName) at java.io.BufferedInputStream..cctor() --- End of inner exception stack trace --- at java.io.BufferedInputStream.__() at java.lang.System.initializeSystemClass() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at IKVM.NativeCode.java.lang.Thread..cctor() --- End of inner exception stack trace --- at IKVM.NativeCode.java.lang.Class.forName0(String name, Boolean initialize, Object loader) at java.lang.Class.forName(String className) at net.sf.saxon.dotnet.DotNetExtensionFunctionFactory.class$(String x0) at net.sf.saxon.dotnet.DotNetExtensionFunctionFactory..ctor(Configuration config) at net.sf.saxon.dotnet.DotNetPlatform.initialize(Configuration config) at net.sf.saxon.Configuration.init() at net.sf.saxon.Configuration..ctor() at Saxon.Api.Processor..ctor() at BealSaxxon._Default.Page_Load(Object sender, EventArgs e)
  
If I write equivalent code and execute it from a windows application and run that application from the same machine, it works fine. 

There is some factor in play between the IIS code and the windows application that I cannot figure out. 






------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help 


------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help