我创建了一个基本的Saxon4.0应用程序并引用了.NET程序集。下面是我在项目中引用的dll的列表。
saxon9.dll saxon9api.dll IKVM.OpenJDK.ClassLibrary.dll IKVM.Runtime.dll
应用程序的代码如下:
Sub Main()
Console.WriteLine("Trying to instantiate SaxonProcessor...")
Try
Dim SaxonProcessor As Saxon.Api.Processor = New Saxon.Api.Processor()
Catch ex As Exception
Console.WriteLine("Error: " & ex.Message & ex.StackTrace)
Console.Read()
End Try
Console.WriteLine("Saxon instantiated successfully!")
Console.Read()
End Sub当我在我们的IIS机器上运行这个应用程序时,我得到了以下输出:
正在尝试实例化SaxonProcessor...Saxon实例化成功!
然后,我创建了一个基本的web应用程序项目,并引用了与windows应用程序相同的文件。我将web应用程序部署到一个包含所有引用的程序集的虚拟目录中。我将以下代码放入我的Default.aspx页面中:
公共类_Default继承System.Web.UI.Page
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结束类
当我加载页面时,它给了我这样的异常:
正在尝试实例化SaxonProcessor...Error:'IKVM.NativeCode.java.lang.Thread‘的类型初始值设定项引发异常。在IKVM.NativeCode.java.lang.Class.forName0(String名称,布尔初始化,对象加载器)在java.lang.Class.forName0(字符串,布尔值,ClassLoader )在net.sf.saxon.dotnet.DotNetExtensionFunctionFactory..ctor(Configuration配置)在net.sf.saxon.dotnet.DotNetPlatform.initialize(Configuration配置)在net.sf.saxon.Configuration.init()在net.sf.saxon.Configuration..ctor()在Saxon.Api.Processor..ctor()在BealSaxxon._Default.Page_Load(对象发送器,C:\Users\u0147101\Desktop\BealSaxxon\BealSaxxon\Default.aspx.vb:line 9中的EventArgs e)
来自IIS计算机的完整STACKTRACE:
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.__<clinit>()
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 EDG.Transforms..ctor()
at EDG.Main..ctor(NameValueCollection applicationSettings, List`1 exceptionList)
at EDG.EGallery..ctor(NameValueCollection ConfigurationSettings, List`1 ExceptionList)以前有没有人见过这种异常?我在谷歌上进行了广泛的搜索,但似乎没有人有这个特别的例外。我认为这是IIS的权限问题,但我不确定。此应用程序在其下运行的应用程序池由计算机管理员设置。
发布于 2012-09-19 21:43:10
在这种情况下,是一个名为OpNET的产品干扰了使用JVM的应用程序。一旦它的服务和进程停止,Saxon程序集就可以正常工作。
发布于 2012-09-13 04:44:23
我认为这可能是两种类型的原因。
缺少IKVM之一的
https://stackoverflow.com/questions/12391913
复制相似问题