我正在尝试使用OpenNLP.Net Nuget包。我创建了一个示例项目,但在创建java.io.FileInputStream对象时遇到了TypeInitialization异常。
"' java.io.File'的类型初始值设定项抛出异常。"
有什么想法吗?
我的IKVM.net版本号是7.4.5196.0,VS2013,.NET 4.5
由于
编辑:
我正在尝试使用nuget包的示例代码: https://cwiki.apache.org/confluence/display/OPENNLP/Introduction+to+using+openNLP+in+.NET+Projects
Exception ToString() is "The function evaluation was disabled because of an out of memory exception".
_Hresult = -2146233036
_message = The type initializer for 'java.io.File' threw an exception.
这是来自IntelliTrace的堆栈:
IKVM.OpenJDK.Core.dll!java.util.Hashtable.rehash() C#
IKVM.OpenJDK.Core.dll!java.util.Hashtable.put(object key = "java.ext.dirs", object value = "") C#
IKVM.OpenJDK.Core.dll!java.util.Properties.setProperty(string key = "java.ext.dirs", string value = "") C#
IKVM.OpenJDK.Core.dll!java.lang.VMSystemProperties.initCommonProperties(java.util.Properties = {java.util.Properties}) C#
IKVM.OpenJDK.Core.dll!java.lang.VMSystemProperties.initProperties(java.util.Properties = {java.util.Properties}) C#
IKVM.OpenJDK.Core.dll!java.lang.Props..cctor() C#
IKVM.OpenJDK.Core.dll!java.lang.System.getProperty(string key = "sun.io.useCanonCaches") C#
IKVM.OpenJDK.Core.dll!java.io.FileSystem.getBooleanProperty(string = "sun.io.useCanonCaches", bool = true) C#
IKVM.OpenJDK.Core.dll!java.io.FileSystem..cctor() C#
IKVM.OpenJDK.Core.dll!java.io.File..cctor() C#
IKVM.OpenJDK.Core.dll!java.io.FileInputStream..ctor(string name = "C:\\nlp\\en-sent.bin") C#
> OpenNLPTest.exe!OpenNLPTest.EntityExtractor.prepareSentenceDetector() C#
OpenNLPTest.exe!OpenNLPTest.Program.Main(string[] args = {string[0]}) C#
OpenNLPTest.exe!OpenNLPTest.EntityExtractor.ExtractEntities(string inputData = "I am still here", EntityType targetType = Person) C#
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() C#
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}, bool preserveSyncCtx = {unknown}) C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}, bool preserveSyncCtx = {unknown}) C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}) C#
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() C#
这里的文件c:\ nlp \ en-sent.bin是~100kb