1

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

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)
riQQ
  • 9,878
  • 7
  • 49
  • 66

1 Answers1

1

Does your code use generics? According to the Proxygen documentation, the tool cannot generate bridging wrappers for method signatures which include generic types.

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.

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 (e.g. wrap List<MyObj> in a MyObjList class) and place these non-generic classes in a different project.

Anson
  • 55
  • 6