简体   繁体   English

proxygen 抛出 System.NullReferenceException

[英]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.

相关问题 在jni4net中执行proxygen时出现KeyNotFoundException - KeyNotFoundException when execute proxygen in jni4net 是否有任何情况System.arraycopy抛出IndexOutOfBoundsException? - Is there any circumstance that System.arraycopy throws IndexOutOfBoundsException? 系统范围Jar抛出类未找到异常 - System Scope Jar Throws Class Not Found Exception PowerMock-模拟静态系统类会抛出IllegalStateException - PowerMock - Mocking static system class throws IllegalStateException System.out.println()不会引发异常,但是System.in.read()会引发异常,为什么? - System.out.println() don't throws Exception, but System.in.read() throws Exception, Why? SecurityManager.checkPropertyAccess会为现有系统属性引发AccessControlException - SecurityManager.checkPropertyAccess throws AccessControlException for existing system property .NET系统对Bouncy Castle Java解密的加密引发错误 - .NET System Encryption to Bouncy Castle Java Decryption Throws Error System.out.printf方法抛出标志异常 - System.out.printf method throws a flags exception jdbi引发SQLException:未知系统变量&#39;tx_read_only&#39; - jdbi throws SQLException: Unknown system variable 'tx_read_only' 单击登录按钮时系统抛出超时错误 - System throws time out error during on click on login button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM