使用IKVM的MissingMethodException

时间:2015-04-16 01:58:35

标签: stanford-nlp ikvm missingmethodexception

我试图在C#中使用Stanford CoreNLP(这是一个Java项目)。

我发现这个Nuget package包含使用IKVM转换为.NET的CoreNLP,并且它工作正常,但我也需要对java项目进行一些修改。

我从Github下载了CoreNLP,我可以从Ant构建CoreNLP JAR,并且它在eclipse中运行正常,但我在将JAR转换为DLL时遇到问题即可。基于我在谷歌中找到的一些build-log,我这样做:

ikvmc.exe  -version:2.1 ..\lib\joda-time.jar -out:joda-time.dll 
ikvmc.exe  -r:joda-time.dll -version:0.4.7 ..\lib\jollyday-0.4.7.jar -out:jollyday.dll 
ikvmc.exe  -version:0.23 ..\lib\ejml-0.23.jar -out:ejml-0.23.dll 
ikvmc.exe  -version:1.2.10 ..\lib\xom-1.2.10.jar -out:xom.dll 
ikvmc.exe  -version:1.0 ..\lib\javax.json.jar -out:javax.json.dll 
ikvmc.exe  -r:joda-time.dll -r:jollyday.dll -r:ejml-0.23.dll -r:xom.dll -r:javax.json.dll -version:3.5.0 ..\javanlp-core.jar -out:javanlp-core.dll 

我从以下转换获得的所有内容都是关于无法找到的引用分类的一些警告:

warning IKVMC0100: Class "org.apache.xerces.parsers.SAXParser" not found
warning IKVMC0100: Class "junit.framework.TestCase" not found
warning IKVMC0100: Class "org.apache.xerces.impl.Version" not found
...
warning IKVMC0100: Class "junit.framework.TestCase" not found
warning IKVMC0100: Class "javax.servlet.http.HttpServlet" not found
warning IKVMC0100: Class "javax.servlet.Filter" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor$InternalDescriptorAssigner" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$Builder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage" not found
warning IKVMC0100: Class "com.google.protobuf.MessageOrBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessage" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessageOrBuilder" not found
warning IKVMC0100: Class "com.google.protobuf.Internal$EnumLiteMap" not found
warning IKVMC0100: Class "com.google.protobuf.ProtocolMessageEnum" not found
warning IKVMC0100: Class "junit.framework.TestSuite" not found
warning IKVMC0100: Class "junit.framework.Assert" not found
warning IKVMC0100: Class "com.apple.eawt.ApplicationAdapter" not found
warning IKVMC0100: Class "org.junit.Assert" not found
warning IKVMC0100: Class "org.apache.lucene.analysis.core.KeywordAnalyzer" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexWriterConfig" not found
warning IKVMC0100: Class "org.apache.lucene.util.Version" not found
warning IKVMC0100: Class "org.apache.lucene.store.FSDirectory" not found
warning IKVMC0100: Class "org.apache.lucene.index.DirectoryReader" not found
warning IKVMC0100: Class "org.apache.lucene.search.IndexSearcher" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanQuery" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause" not found
warning IKVMC0100: Class "org.apache.lucene.search.TermQuery" not found
warning IKVMC0100: Class "org.apache.lucene.index.Term" not found
warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause$Occur" not found
warning IKVMC0100: Class "org.apache.lucene.search.TopDocs" not found
warning IKVMC0100: Class "org.apache.lucene.search.ScoreDoc" not found
warning IKVMC0100: Class "org.apache.lucene.document.Document" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexWriter" not found
warning IKVMC0100: Class "org.apache.lucene.queryparser.classic.ParseException" not found
warning IKVMC0100: Class "org.apache.lucene.document.StringField" not found
warning IKVMC0100: Class "org.apache.lucene.document.Field$Store" not found
warning IKVMC0100: Class "org.apache.lucene.document.Field" not found
warning IKVMC0100: Class "org.apache.lucene.search.Query" not found
warning IKVMC0100: Class "org.apache.lucene.store.Directory" not found
warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex" not found
warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex$Status" not found
warning IKVMC0100: Class "org.apache.lucene.store.NIOFSDirectory" not found
warning IKVMC0100: Class "org.apache.lucene.util.BytesRef" not found
warning IKVMC0100: Class "org.apache.lucene.index.IndexReader" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors$Descriptor" not found
warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$FieldAccessorTable" not found
warning IKVMC0100: Class "com.google.protobuf.Descriptors" not found
warning IKVMC0100: Class "junit.framework.AssertionFailedError" not found
warning IKVMC0100: Class "org.apache.lucene.document.FieldType" not found

P.S。:我也试过转换protobuf.jar,但没有帮助解决下面描述的问题。

问题是:当我为新编译的引用(6个dll)替换Nuget引用时,它编译正常(找到所有引用),但抛出此 MissingMethodException:附加信息:找不到方法:&#39 ; Void edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(java.util.Properties)'。

任何人都能解开一些光明吗?

1 个答案:

答案 0 :(得分:1)

我想我想通了。这是固定的:

  1. 删除了Nuget包IKVM 8.0.5449.1
  2. 已安装的Nuget包IKVM 8.0.5449.0(我用于转换我的JAR文件的version
  3. 清理并重建。
  4. 如果我理解正确,我用来转换我的JAR文件的ikvmc.exe必须与引用的运行时DLL的版本相同。