Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

MSWMI example testing got some new errors using j-interop 3.0

Mike J
2013-07-11
2013-07-17
  • Mike J
    Mike J
    2013-07-11

    I ran MSWMI example by,

    execute ipaddress domain user_id password

    it shown just the data for one object, then got an exception as like,

    object2 unreferenced...
    org.jinterop.dcom.common.JIException: Incorrect function. [0x00000001]
    at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:999)
    at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:945)
    at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:271)
    at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:156)
    at org.jinterop.dcom.impls.automation.JIEnumVARIANTImpl.next(JIEnumVARIANTImpl.java:5
    at org.jinterop.dcom.test.MSWMI.performOp(MSWMI.java:132)
    at org.jinterop.dcom.test.MSWMI.main(MSWMI.java:173)
    Caused by: org.jinterop.dcom.common.JIRuntimeException: Incorrect function. [0x00000001]
    at org.jinterop.dcom.core.JICallBuilder.readResult(JICallBuilder.java:1095)
    at org.jinterop.dcom.core.JICallBuilder.read(JICallBuilder.java:969)
    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.call(JIComServer.java:990)

    it would show a list of objects in the name space. The old version 2.08 has no such a problem.

    BTW, if the com server is a win 2008 server(r2 64 bits), it still got "access is denied" issue. It seemed like the auto registration permission issue remained. I meant unless you manually change the permission on the SWbemLocator to full control, you cannot make a connection to the com server.

    I searched online and found that the Jenkins uses the j-interop for their master/slave server communications. and they run into the same issue of "access denied" on some of win boxes. It's interesting to notice that the author of the Jinkens is also the owner of another java open source, com4j. Furthermore, using the com4j to connect to a win2008 server r2 64 bits has no issue. My question is why the author of com4j didn't use the com4j for Jenkins?

    I also tried HP's WMIMapper app for DCOM connection. It worked no need of any config changes on a win 2008 server (r2, 64 bits). I guessed there must have been some differences in implementations among them. Is the in proc or out of proc services make the difference?

     
    • Hi Mike,

      object2 unreferenced...
      org.jinterop.dcom.common.JIException: Incorrect function. [0x00000001]
      at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:999)
      at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:945)
      at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:271)
      at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:156)
      at
      org.jinterop.dcom.impls.automation.JIEnumVARIANTImpl.next(JIEnumVARIANTImpl.java:5
      at org.jinterop.dcom.test.MSWMI.performOp(MSWMI.java:132)
      at org.jinterop.dcom.test.MSWMI.main(MSWMI.java:173)
      Caused by: org.jinterop.dcom.common.JIRuntimeException: Incorrect
      function. [0x00000001]
      at org.jinterop.dcom.core.JICallBuilder.readResult(JICallBuilder.java:1095)
      at org.jinterop.dcom.core.JICallBuilder.read(JICallBuilder.java:969)
      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.call(JIComServer.java:990)

      This should not have happened. We have not touched the core functionality
      but only the handshake mechanism. Plus this test was run here. If I may
      ask, are you getting this consistently ?

      BTW, if the com server is a win 2008 server(r2 64 bits), it still got
      "access is denied" issue. It seemed like the auto registration permission
      issue remained. I meant unless you manually change the permission on the
      SWbemLocator to full control, you cannot make a connection to the com
      server.

      Its not an "issue" per se. That is how the SWbemLocator works. It is not
      registered by default on all Operating systems and hence needs to be
      registered by us. That is why we need to implement and work with the
      IWBemLocator (the real WMI impl) and not its Scripting counter part.

      I searched online and found that the Jenkins uses the j-interop for their
      master/slave server communications. and they run into the same issue of
      "access denied" on some of win boxes. It's interesting to notice that the
      author of the Jinkens is also the owner of another java open source, com4j.
      Furthermore, using the com4j to connect to a win2008 server r2 64 bits has
      no issue. My question is why the author of com4j didn't use the com4j for
      Jenkins?

      May be because Com4J is native.

      I also tried HP's WMIMapper app for DCOM connection. It worked no need of
      any config changes on a win 2008 server (r2, 64 bits). I guessed there must
      have been some differences in implementations among them. Is the in proc or
      out of proc services make the difference?

      Yes you are right. The difference in implementation between it and WMI
      examples in j-Interop is that, j-Interop examples use the Scripting locator
      and not the WMI Locator (IWbemLocator). The latter is registered on all
      Windows machines by default and has the necessary permissions to let Admins
      work on it.

      thanks,
      best regards,
      Vikram

      --
      The Mind is a place of its own. It can make a heaven out of hell or a hell
      out of heaven. Attitude is everything. No matter how adverse conditions
      maybe, one has the capacity to turn things around by one's Determination,
      Perseverance and Hardwork.

      John Milton
      (Paradise Lost)

       
  • Mike J
    Mike J
    2013-07-15

    Thank you for your great answers.
    Does a pure java app only work with Scripting locator, but not the general WMI Loctor(IWbemLocator)? If no, then is j-interop going to implement a solution for using IWbemLocator? or ourselves can implement the IWbemLoctor for a pure java solution? Our app does not allow any manual setting on the com server sides.

     
  • Mike J
    Mike J
    2013-07-15

    using the j-interop 2.08, I tested with the suggested class, Wbem Locator with class id {4590F811-1D3A-11D0-891F-00AA004B2E24} and got the error like (Please let me know if it's not the correct class to invoke),

    EXCEPTION FROM SERVER ! --> 0x80040154
    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:681)
    at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:513)
    at org.jinterop.dcom.core.JIComServer.<init>(JIComServer.java:476)
    at org.jinterop.dcom.test.MSWMI.<init>(MSWMI.java:40)
    at org.jinterop.dcom.test.MSWMI.main(MSWMI.java:179)
    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.JIRemActivation.read(JIRemActivation.java:210)
    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:666)
    ... 4 more

    And after that, the JIComServer tried to do a 64 bit registry as follows,

    if (hkwow6432 != null) {
    JISystem.getLogger().info("Attempting to register on 64 bit");
    // HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID{E4BE20A4-9EF1-4B05-9117-AF43EAB4B295}\ -- "AppID"
    JIPolicyHandle key = registry.winreg_CreateKey(hkwow6432, "CLSID\{" + this.clsid + "}",
    IJIWinReg.REG_OPTION_NON_VOLATILE, IJIWinReg.KEY_ALL_ACCESS);

    the last line got an error like,

    org.jinterop.dcom.common.JIException: Access is denied, please check whether the [domain-username-password] are correct. Also, if not already done please check the GETTING STARTED and FAQ sections in readme.htm. They provide information on how to correctly configure the Windows machine for DCOM access, so as to avoid such exceptions. [0x00000005]
    at org.jinterop.winreg.smb.JIWinRegStub.winreg_CreateKey(JIWinRegStub.java:310)
    at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:571)
    at org.jinterop.dcom.core.JIComServer.<init>(JIComServer.java:476)
    at org.jinterop.dcom.test.MSWMI.<init>(MSWMI.java:40)
    at org.jinterop.dcom.test.MSWMI.main(MSWMI.java:179)
    Caused by: org.jinterop.dcom.common.JIRuntimeException: Access is denied, please check whether the [domain-username-password] are correct. Also, if not already done please check the GETTING STARTED and FAQ sections in readme.htm. They provide information on how to correctly configure the Windows machine for DCOM access, so as to avoid such exceptions. [0x00000005]
    at org.jinterop.winreg.IJIWinReg$createKey.read(IJIWinReg.java:459)
    at ndr.NdrObject.decode(NdrObject.java:36)
    at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:137)
    at rpc.Stub.call(Stub.java:113)
    at org.jinterop.winreg.smb.JIWinRegStub.winreg_CreateKey(JIWinRegStub.java:304)
    ... 4 more

    The same errors as we got when using WbemScripting.SWbemLocator.

    Any thought?

     
    • Hi Mike,

      The CLSID for IWbemLocator is "8BC3F05E-D86B-11d0-A075-00C04FB68820".
      Please try with this.

      thanks,
      best regards,
      Vikram

      On Mon, Jul 15, 2013 at 11:46 PM, Mike J mikej1688@users.sf.net wrote:

      using the j-interop 2.08, I tested with the suggested class, Wbem Locator
      with class id {4590F811-1D3A-11D0-891F-00AA004B2E24} and got the error like
      (Please let me know if it's not the correct class to invoke),

      EXCEPTION FROM SERVER ! --> 0x80040154
      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:681)
      at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:513)
      at org.jinterop.dcom.core.JIComServer.(JIComServer.java:476)
      at org.jinterop.dcom.test.MSWMI.(MSWMI.java:40)
      at org.jinterop.dcom.test.MSWMI.main(MSWMI.java:179)
      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.JIRemActivation.read(JIRemActivation.java:210)
      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:666)
      ... 4 more

      And after that, the JIComServer tried to do a 64 bit registry as follows,

      if (hkwow6432 != null) {
      JISystem.getLogger().info("Attempting to register on 64 bit");
      //
      HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID{E4BE20A4-9EF1-4B05-9117-AF43EAB4B295}\ -- "AppID"
      JIPolicyHandle key = registry.winreg_CreateKey(hkwow6432, "CLSID{" +
      this.clsid + "}",
      IJIWinReg.REG_OPTION_NON_VOLATILE, IJIWinReg.KEY_ALL_ACCESS);

      the last line got an error like,

      org.jinterop.dcom.common.JIException: Access is denied, please check
      whether the [domain-username-password] are correct. Also, if not already
      done please check the GETTING STARTED and FAQ sections in readme.htm. They
      provide information on how to correctly configure the Windows machine for
      DCOM access, so as to avoid such exceptions. [0x00000005]
      at
      org.jinterop.winreg.smb.JIWinRegStub.winreg_CreateKey(JIWinRegStub.java:310)
      at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:571)
      at org.jinterop.dcom.core.JIComServer.(JIComServer.java:476)
      at org.jinterop.dcom.test.MSWMI.(MSWMI.java:40)
      at org.jinterop.dcom.test.MSWMI.main(MSWMI.java:179)
      Caused by: org.jinterop.dcom.common.JIRuntimeException: Access is denied,
      please check whether the [domain-username-password] are correct. Also, if
      not already done please check the GETTING STARTED and FAQ sections in
      readme.htm. They provide information on how to correctly configure the
      Windows machine for DCOM access, so as to avoid such exceptions.
      [0x00000005]
      at org.jinterop.winreg.IJIWinReg$createKey.read(IJIWinReg.java:459)
      at ndr.NdrObject.decode(NdrObject.java:36)
      at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:137)
      at rpc.Stub.call(Stub.java:113)
      at
      org.jinterop.winreg.smb.JIWinRegStub.winreg_CreateKey(JIWinRegStub.java:304)
      ... 4 more

      The same errors as we got when using WbemScripting.SWbemLocator.

      Any thought?

      MSWMI example testing got some new errors using j-interop 3.0https://sourceforge.net/p/j-interop/discussion/841020/thread/5cc6c8ce/?limit=25#e45c

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/j-interop/discussion/841020/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      The Mind is a place of its own. It can make a heaven out of hell or a hell
      out of heaven. Attitude is everything. No matter how adverse conditions
      maybe, one has the capacity to turn things around by one's Determination,
      Perseverance and Hardwork.

      John Milton
      (Paradise Lost)

       
  • Mike J
    Mike J
    2013-07-16

    Hi Vikram,

    Thanks.

    However, the class id, 8BC3F05E-D86B-11d0-A075-00C04FB68820, is for WbemLevel1Login, not for IWbemLocator, isn't it? I have used it last year and the line below,

    JIComServer comStub = new JIComServer(JIClsid.valueOf("8BC3F05E-D86B-11D0-A075-00C04FB68820"), address, session); //WbemLevel1Login
    

    had no problem. But the next line didn't work,
    IJIComObject unknown = comStub.createInstance();

    The error is,
    org.jinterop.dcom.common.JIException: Access is denied. [0x80070005]
    at org.jinterop.dcom.core.JIRemUnknownServer.call(JIRemUnknownServer.java:161)
    at org.jinterop.dcom.core.JIRemUnknownServer.addRef_ReleaseRef(JIRemUnknownServer.java:181)
    at org.jinterop.dcom.core.JISession.addRef_ReleaseRef(JISession.java:860)
    at org.jinterop.dcom.core.JIComObjectImpl.addRef(JIComObjectImpl.java:119)
    at org.jinterop.dcom.core.JIComServer.createInstance(JIComServer.java:913)
    at org.jinterop.dcom.test.MSWMI.<init>(MSWMI.java:45)

    According to what you said, if the API with WbemScripting is a scaled down version of the IWbemLoctor API, do you think it's worth trying it?
    
     
    • Dear Mike,

      Scripting locator is used by VBScript, ASP, HTML applications to gather WMI
      data (
      http://msdn.microsoft.com/en-us/library/windows/desktop/aa389761%28v=vs.85%29.aspx).
      Basically the wrapper covers almost all APIs of the WBem namespace.
      Performance and this step of Registration are the only two things missing.
      So it depends on what is your objective.

      For Access Denied: Are you using an Admin user ? Having you set j-Interop
      to use NTLM session security ? Sometimes not setting the later will also
      cause this exception.

      thanks,
      best regards,
      Vikram

      On Tue, Jul 16, 2013 at 10:35 PM, Mike J mikej1688@users.sf.net wrote:

      Hi Vikram,

      Thanks.

      However, the class id, 8BC3F05E-D86B-11d0-A075-00C04FB68820, is for
      WbemLevel1Login, not for IWbemLocator, isn't it? I have used it last year
      and the line below,

      JIComServer comStub = new JIComServer(JIClsid.valueOf("8BC3F05E-D86B-11D0-A075-00C04FB68820"), address, session); //WbemLevel1Login

      had no problem. But the next line didn't work,
      IJIComObject unknown = comStub.createInstance();

      The error is,
      org.jinterop.dcom.common.JIException: Access is denied. [0x80070005]
      at
      org.jinterop.dcom.core.JIRemUnknownServer.call(JIRemUnknownServer.java:161)
      at
      org.jinterop.dcom.core.JIRemUnknownServer.addRef_ReleaseRef(JIRemUnknownServer.java:181)
      at org.jinterop.dcom.core.JISession.addRef_ReleaseRef(JISession.java:860)
      at org.jinterop.dcom.core.JIComObjectImpl.addRef(JIComObjectImpl.java:119)
      at org.jinterop.dcom.core.JIComServer.createInstance(JIComServer.java:913)
      at org.jinterop.dcom.test.MSWMI.(MSWMI.java:45)

      According to what you said, if the API with WbemScripting is a scaled down version of the IWbemLoctor API, do you think it's worth trying it?


      MSWMI example testing got some new errors using j-interop 3.0https://sourceforge.net/p/j-interop/discussion/841020/thread/5cc6c8ce/?limit=25#59c3

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/j-interop/discussion/841020/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      The Mind is a place of its own. It can make a heaven out of hell or a hell
      out of heaven. Attitude is everything. No matter how adverse conditions
      maybe, one has the capacity to turn things around by one's Determination,
      Perseverance and Hardwork.

      John Milton
      (Paradise Lost)