5 Replies Latest reply on Jan 22, 2015 4:55 AM by shankar.ecgit Branched from an earlier discussion.

    Retrieving the COM class factory...failed due to the following error: 80080005

    shankar.ecgit

      Hello Everyone,

       

      I am also attempting to do something similar.

       

      I am trying to open a processbook via a PI ACE class module, and am saving it as jpg, and then e-mailing the saved file.


      The code works fine when we debug - but during run time . ie.  I get the below error .. I have also shared the code so that anyone can help me debug it

       

      Retrieving the COM class factory for component with CLSID {7BFECD80-1B23-101C-B28E-00AA0022EF07} failed due to the following error: 80080005.

       

              

              Dim myProcessBookapp As New PBObjLib.Application

              Dim sSenderId As String

              Dim myPISDK As PISDK.PISDK

              Dim RootModule As PIModule

              Dim pTriggerTag As PIPoint

              myPISDK = New PISDK.PISDK

              Dim zDebugFile As String

              Dim sb As New StringBuilder()

              Dim myPB As New PBObjLib.Display

       

              zDebugFile = "E:\AutoMail_" + Replace(Replace(Replace(Replace(Replace(Now, "\", ""), ":", ""), "#", ""), "/", ""), " ", "") + ".txt"

              sb.AppendLine("Trigger Tag : " & TriggerTag.Value)

              If TriggerTag.Value = 1 Then
                  RootModule = PIACEBIFunctions.GetPIModuleFromPath(Context)
                  sSenderId = RootModule.PIProperties("ToEmail").Value

                  myPB = myProcessBookapp.ProcBooks.Open("E:\Screen1.PDI", False)
                  myProcessBookapp.ActiveDisplay.Height = 780
                  myProcessBookapp.ActiveDisplay.Width = 1100
                  'myProcessBookapp.ActiveDisplay.Scroll(0, 0, 0, 100, 10, 10)
                  myProcessBookapp.ActiveDisplay.Scroll(0, -140)

                  myProcessBookapp.ActiveDisplay.SaveAs("E:\Page-1.jpg", PBObjLib.pbpdFILEFORMAT.pbpdFormatJPEG)

                  sb.AppendLine("First Page is Saved")

                  myPB = myProcessBookapp.ProcBooks.Open("E:\Screen2.PDI", False)
                  myProcessBookapp.ActiveDisplay.Height = 780
                  myProcessBookapp.ActiveDisplay.Width = 1000
                  'myProcessBookapp.ActiveDisplay.Scroll(0, 0, 0, 100, 10, 10)
                  myProcessBookapp.ActiveDisplay.Scroll(0, -180)

       

                  myProcessBookapp.ActiveDisplay.SaveAs("E:\Page-2.jpg", PBObjLib.pbpdFILEFORMAT.pbpdFormatJPEG)

                  sb.AppendLine("Second Page is Saved")
                  myPB.Close(False)

                  myProcessBookapp.Quit()
                  SendMailOneAttachment("E:\Page-1.jpg", "Page-2.jpg", sSenderId)

                  sb.AppendLine("E Mail is Sent")


              End If

              Using outfile As New StreamWriter(zDebugFile)
                  outfile.Write(sb.ToString())
              End Using

       

       

        • Re: Retrieving the COM class factory...failed due to the following error: 80080005
          bshang

          Hi Shankar,

           

          I've moved your post as it's own discussion to give it greater visibility. This can be a tricky issue.

           

          The error 80080005 is a DCOM error code. Usually this means that the user account has limited privileges and restricted access to the executable (and/or related files).

           

          The CLSID ( {7BFECD80-1B23-101C-B28E-00AA0022EF07} ) is a reference to "PIProcessBook Polygon Symbol". In DCOM, it's Local Path should be "C:\PROGRA~1\PIPC\Procbook\Procbook.exe /Automation". Can you check on your end? Launch 32-bit DCOM via cmd "mmc /32 %windir%\syswow64\comexp.msc". Then drill down to My Computer> DCOMConfig> PIProcessBook Polygon Symbol and right-click Properties. Local Path is the General tab.

          Also, check the Local Path for this CLSID in regedit. It should point to procbook.exe.

           

          Also, can we check the service account running the ACE Scheduler? By default, it is Local System, which should have permissions to execute the procbook.exe, but let's check to be sure.

          Upon PB startup, it also looks for its procbook.INI file and pbtoolbarconfig.INI file in the %localappdata% folder for the user opening up PB.

           

          I'm not sure what the location should be for Local System, and some sort of file contention/corruption during INI loading might be an issue. Hopefully, others here can help out. One difference between runtime and debugging is the user context under which PB is opened. There may be a problem with Local System.

           

          Other things we'd like to know:

          1. Is the scheduler and dev environment on the same machine? Is the same installation of PB being launched and same file being opened?

          2. If separate machines, then check version consistency, folder structure consistency, etc. between the two machines

          3. Event Viewer logs. Does it indicate if procbook.exe was ever instantiated successfully at runtime?

          4. Turn on DCOM error logging (see steps in resolution). In runtime, they will be written to the Event Viewer logs.

          5. Enclose the relevant block of code in a Try Catch and write the run-time error to the PI SDK logs on the scheduler machine.

           

          As a somewhat orthogonal direction, if the ACE scheduler is currently running as Local System, you can consider running it as a dedicated service account and see if that mitigates the issue.

           

          FYI, we've also opened TS case 605070 to track this issue.

          • Re: Retrieving the COM class factory...failed due to the following error: 80080005
            shankar.ecgit

            Hello Barry,

             

            Thank you very much for the detailed reply. it really helped.

             

            The issue is now resolved !!! .. Here is what was happening.

             

            1)The CLSID {7BFECD80-1B23-101C-B28E-00AA0022EF07} in my case was pointing to PI Processbook Batch Gantt Symbol and the application path was "C:\PROGRA~2\PIPC\Procbook\Procbook.exe /Automation" .. I think, I had Progra~2 because the machine I am executing is a 64 bit machine.

            2) Localpath in both Registry as well as DCOM were pointing to procbook.exe

            3) I turned on DCOM error logging, but it was pointing to issue with ntdll.dll, by which I was not able to infer much.

            4) As you pointed out, since the code works in debug mode, and was not working in runtime - It could be credential mismatch issue. So I changed the ACE scheduler login privelages to my user account, and restarted the scheduler. Then I ran it again .. and ...it worked!!

             

            So basically next step is to get a dedicated service account for PI ACE Scheduler which has same domain privelages as my user login.. .That should put the issue completely to rest.

             

            Thanks once again for the quick reply, I think techsupport case # 605070 can also be closed for this.

             

            Regards,

            Shankar

            • Re: Retrieving the COM class factory...failed due to the following error: 80080005
              shankar.ecgit

              Hello Barry,

               

              Update :

               

              The DCOM error returned after a few executions.

               

              Finally I updated the Processbook DCOM configuration to include the service account in "Identity" tab.

               

              Processbook_DCOM_Screenshot.JPG

               

              Now the code executes without any DCOM errors.

               

              However I want to know the impact of this setting. If this will cause processbook to not work under a different login.

               

              Regards,

              Shankar

                • Re: Retrieving the COM class factory...failed due to the following error: 80080005
                  bshang

                  Hi Shankar,

                   

                  Are you still getting issues after changing the DCOM identity?

                   

                  If the user specified here matches with the service account running the ACE scheduler, then there shouldn't be any issues, as long as the service account has the required permission on the PI server.

                   

                  An issue can arise if other users are opening up the same procbook.exe, as other users may end up using the same COM instance. For the use case here in which PB is being repeatedly opened/closed by a service, I'd recommend using a dedicated installation of PB that is only accessed by the ACE scheduler and no other users. This will minimize the chances of DCOM/class factory/etc. errors from popping up in the future.