[英]proxygen throws System.NullReferenceException
I want to use a dll file in our java application, I am using jni4net, when i tried to create proxy for our Dll it throws我想在我们的 Java 应用程序中使用一个 dll 文件,我正在使用 jni4net,当我尝试为我们的 Dll 创建代理时它抛出
System.NullReferenceException: Object reference not set to an instance of an object.
at net.sf.jni4net.proxygen.model.Repository.RegisterType(Type type, TypeRegistration registration)
at net.sf.jni4net.proxygen.model.Repository.RegisterType(Type type)
at net.sf.jni4net.proxygen.model.Repository.RegisterType(Type type, TypeRegistration registration)
at net.sf.jni4net.proxygen.model.Repository.Register()
at net.sf.jni4net.proxygen.Program.Work(String[] args)
at net.sf.jni4net.proxygen.Program.Main(String[] args)
Does your code use generics?您的代码是否使用泛型? According to the Proxygen documentation, the tool cannot generate bridging wrappers for method signatures which include generic types.根据 Proxygen 文档,该工具无法为包含泛型类型的方法签名生成桥接包装器。
I encountered the same error message and the use of generics in public method signatures turned out to be the problem.我遇到了同样的错误消息,结果证明在公共方法签名中使用泛型是问题所在。 I worked around the issue by using the Proxygen branch referenced here .我通过使用此处引用的 Proxygen 分支解决了该问题。
Edit: direct link to the branch.编辑: 直接链接到分支。
Alternatively you could try to use non-generic data structures instead, or to wrap your generic data structures in non-generic classes (eg wrap List<MyObj>
in a MyObjList
class) and place these non-generic classes in a different project.或者,您可以尝试使用非泛型数据结构,或者将泛型数据结构包装在非泛型类中(例如,将List<MyObj>
包装在MyObjList
类中)并将这些非泛型类放在不同的项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.