I am trying to instantiate a JIComServer using JInterop for a custom dll, but I keep on getting the following Exception:
org.jinterop.dcom.common.JIException: Class not registered. If you are using a DLL/OCX , please make sure it has "DllSurrogate" flag set. Faq A(6) in readme.html. [0x80040154]
I went through the JInterop readme to set up my machine properly.
I tried installing the 32 bit JVM (because the dll is 32 bit)
I tried registering a 64 bit dll instead of the 32 bit version.
There is a dllflag in the registry (everything I found online said that its value is supposed to be empty).
The assembly is registered (I can find its CLSID in the registry under the TypeLibrary, AppID and CLSID directories. When I register it (using RegAsm), it is being saved to a .tlb file, does that change anything?)
This is the code:
importorg.jinterop.dcom.common.*;importorg.jinterop.dcom.core.*;importjava.net.UnknownHostException;importjava.util.logging.Level;publicclassTest1{privatestaticfinalStringDOMAIN=arg;privatestaticfinalStringUSERNAME=arg;privatestaticfinalStringPASSWORD=arg;privatestaticfinalStringCLSID="1CCFE037-6C0E-4E33-92DA-4BC3BE772957";publicstaticvoidmain(String[]args){JISystem.setAutoRegisteration(true);JISystem.getLogger().setLevel(Level.FINEST);JISessionsession=JISession.createSession(DOMAIN,USERNAME,PASSWORD);session.useSessionSecurity(true);if(session==null){thrownewNullPointerException("session is null");}JIComServercomServer=null;try{//exceptiongetsthrownherecomServer=newJIComServer(JIClsid.valueOf(CLSID),session);}catch(JIExceptione){e.printStackTrace();}catch(UnknownHostExceptione){e.printStackTrace();}if(comServer==null){thrownewNullPointerException("COM server is null");}IJIComObjectcomObject=null;try{comObject=comServer.createInstance();}catch(JIExceptione){e.printStackTrace();}}`
This is the stack trace:
org.jinterop.dcom.common.JIException: Class not registered. If you are using a DLL/OCX , please make sure it has "DllSurrogate" flag set. Faq A(6) in readme.html. [0x80040154] at
org.jinterop.dcom.core.JIComServer.init(JIComServer.java:669) at
org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:575) at org.jinterop.dcom.core.JIComServer.(JIComServer.java:460) at
org.jinterop.dcom.core.JIComServer.(JIComServer.java:391) at
Test1.main(Test1.java:34) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: org.jinterop.dcom.common.JIRuntimeException: Class not registered. If you are using a DLL/OCX , please make sure it has "DllSurrogate" flag set. Faq A(6) in readme.html. [0x80040154] at
org.jinterop.dcom.core.JIRemoteSCMActivator$RemoteCreateInstance.read(JIRemoteSCMActivator.java:645) at ndr.NdrObject.decode(NdrObject.java:36) at
rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:137) at
rpc.Stub.call(Stub.java:113) at
org.jinterop.dcom.core.JIComServer.init(JIComServer.java:645) ... 9 more
Last edit: Yitzchak Horowitz 2016-07-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to instantiate a JIComServer using JInterop for a custom dll, but I keep on getting the following Exception:
I went through the JInterop readme to set up my machine properly.
I tried installing the 32 bit JVM (because the dll is 32 bit)
I tried registering a 64 bit dll instead of the 32 bit version.
There is a dllflag in the registry (everything I found online said that its value is supposed to be empty).
The assembly is registered (I can find its CLSID in the registry under the TypeLibrary, AppID and CLSID directories. When I register it (using RegAsm), it is being saved to a .tlb file, does that change anything?)
This is the code:
This is the stack trace:
Last edit: Yitzchak Horowitz 2016-07-25