Documents COM object creation failure

Hi all,
We are using the DI API (2005) to access SBO database objects. The API call generally work fine, but we have a problem when creating order objects with the following code (using it's managed wrapper in C#):
Documents docs = conn.Connection.GetBusinessObject(BoObjectTypes.oOrders) as Documents;
getting the folloing exception: 'System.Runtime.InteropServices.SEHException: External component has thrown an exception..'. Creation of other objects (like BusinessPartners, Recordsets, ...) work fine, but as soon as we try to create one of the Document type object (oOrder, oInvoice) we get this error!
Any ideas?
Thanks,
Reinhard

Alternative way of typecasting your object (actually didn't know that one existed).
I use:
Documents docs = (Documents)conn.Connection.GetBusinessObject(BoObjectTypes.oOrders) .. and have never had any problem with it
... Also make sure that the Documents-object is the SAP object (and not from another namespace, although I doubt it given the code you have shown)
SAPbobsCOM.Documents docs = (SAPbobsCOM.Documents)conn.Connection.GetBusinessObject(BoObjectTypes.oOrders)

Similar Messages

  • COM object model not functioning after encrypting the word document using office extention

         After encrypting A word document using office extention, it seems like the COM object model becomes unusable. I cannot not manipulate the encrypt document through COM interface, nor can I write macro VBScript to do some operation on the docuent.
         For example, I create a word Macro with some simple code.
    Sub hi()
        Dim i As Integer
        i = ThisDocument.Fields.Count
        MsgBox i   
    End Sub
         If the document is not encrypt, then we will see a msgbox which tells us the number of bookmarks in the current document.
         Now, encrypt the word document using the office extention, running the macro code will fail with error code " 80004005" and error message:Method 'Fields' of bject 'ThisDocument' failed.
    It is very important for us to manipulate word documents through COM interface in our system, I want to know why the COM interface does not work anymore after the document is encrypted.

    I take macro script as an example to demonstrate that word COM object model cannot be used after encripted. Actually you can reproduce the same problem when you manipulate word document through COM interface using any programming language.
    For example, you can create a text document  with the following VBscript:
    set a = createobject("Word.Application")
    set doc = a.Documents.Open("E:\temp\test.docx")
    msgbox doc.Fields.count
    doc.close
    a.quit
    Save the document with ".vbs" file extention and then run it by double clicking it. it will fail if the document is encrypted using the office extention. 

  • Cannot install Grid control 11g because of repository creation failure

    I cannot install Grid control 11g (on AIX6.1 and 11.2.0.1 database) because of repository creation failure with following log emschema.log.CREATE
    2012-10-29 17:44:49,729 [Thread-190] ERROR emschema.17oypu8dqqrf7 - ERROR:FATAL Configuration Exceptions
    Execution Exception
    null
    2012-10-29 17:44:50,162 [17oypu8dqqrf7] ERROR emschema.17oypu8dqqrf7 - Schema Action Failed
    2012-10-29 17:44:50,163 [17oypu8dqqrf7] ERROR emschema.17oypu8dqqrf7 - java.lang.Exception: The last RCUModel exit status code is not SUCCEEDED.
    2012-10-29 17:44:50,164 [17oypu8dqqrf7] ERROR emschema.17oypu8dqqrf7 - Schema Action Failed
    2012-10-29 17:44:50,167 [17oypu8dqqrf7] ERROR emschema.17oypu8dqqrf7 - Running RCU Failed with Exception Trace
    The last RCUModel exit status code is not SUCCEEDED.
    and rcu.log:
    RCU Logfile               : /ugp1apl/oracle/product/grid/middleware/oms11g/sysman/log/schemamanager/m_102912_0530_PM/m_102912_0530_PM.CREATE/rcu.log
    RCU Checkpoint Object               : /opt/oracle/product/grid/middleware/oms11g/sysman/log/schemamanager//RCUCheckpointObj
    Component schemas created:
    Component               Status     Logfile          
    EM Repository Creation Configuration          Failed     /ugp1apl/oracle/product/grid/middleware/oms11g/sysman/log/schemamanager/m_102912_0530_PM/m_102912_0530_PM.CREATE/em_repos_config.log
    EM Repository Init Configuration          Success     /ugp1apl/oracle/product/grid/middleware/oms11g/sysman/log/schemamanager/m_102912_0530_PM/m_102912_0530_PM.CREATE/em_repos_init.log
    EM Repository Common          Success     /ugp1apl/oracle/product/grid/middleware/oms11g/sysman/log/schemamanager/m_102912_0530_PM/m_102912_0530_PM.CREATE/em_repos_common.log
    2012-10-29 17:44:49.887 NOTIFICATION rcu: oracle.sysman.assistants.common.util.SilentMessageHandler::writeToLog: Repository Creation Utility - Create : Operation Completed
    Database has 11.2.0.1 version and setup according installation guide(init parameters and so on...), what's wrong?
    Edited by: mariok on Oct 31, 2012 2:11 AM

    In install guide is written: http://docs.oracle.com/cd/E11857_01/install.111/e15838/install_em_exist_db.htm#CIAIGDIH
    „No environment variable specific to Enterprise Manager Grid Control needs to be set prior to installation. The ORACLE_HOME and ORACLE_SID variables should not be set; Oracle directories should not appear in the PATH.“
    When I'v set up following variables everything went fine:
    ORACLE_HOME=/opt/oracle/product64/11.2.0.1
    ORACLE_SID=UAGRID
    PATH=/usr/java6_64/bin:/opt/oracle/product64/11.2.0.1/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/lbin:/root/MSP/bin:.:/usr/local/bin:/u1/oracle/SCRIPTS:/opt/oracle/product64/11.2.0.1/OPatch

  • JVM 1.5.0, parallelism and object creation

    Hi.
    I am currently running Java 1.5.0 on a production server. This server is a 4-cpu 2gb ram beast running Red Hat ES 3. It provides MySQL backend and a Java server to be accessed through a Flash client.
    So far, the Flash client fares well. MySQL takes worst cast 16% of one CPU for very heavy selections. But I am having problems with optimizing the Java part that does everything.
    First and foremost, I cannot change the way it is. Our java code is mostly vendor code, thus we can't really expect to be able to easily change the code. Whatever code we added to the vendor code is definitely not the bottleneck, it's optimized, it's properly synchronized and it's very effective.
    I would like to give you an idea of how things fares. You will see my problem soon.
    - I am running one process of Java. This process is -Xms and Xmx'ed to 384 megs.
    - The total DSize of the Java environment is more than a gigabyte due to the 1000+ threads that runs through it. More so, every client that runs through it adds up at least two threads.
    - There are massive object creation and destruction happening. For a 100-client system, the "eden" memory is filled up and GC'ed at least twice per second. Since 1.5.0, the "old" memory of 384m gets filled up in 10 minutes, and GC'ed at that point.
    - CPU usage is having fun between 80% and 150% of one CPU (remember I have 4 CPUs so 150% is 150/400% total usage)
    - GC is the major speed bump for my server, as if I put 768 megs of Xmm instead of 384, cpu usage drops to 60%-90% CPU, that is, until memory gets filled up and swap gets used (do the math: 768m + 1200 thread stacks)
    Now it works fine. 100 users, it's perfect. My major problem is that from next week on, we are planning 300+ users. Ouch.
    So my few questions are:
    - In knowing that garbage must constantly be collected, is there something I can do in the environment to make it happen all the time in background? Or am I bound to have all 4 cpu's stopped momentarily twice per second so that it might happen?
    - In 1.4.x, I could change "eden" memory block size. It doesn't seem to be the same for 1.5.x. What's up with that? I used to increase it dramatically, making GC longer but less frequent, increasing parallelism force.
    I am asking the questions because I am not in position of trying "what if"s with my production server. The test server handles well our 8 internal users ... but we are not close of making the same amount of request as our 100-users production server... so we cannot reliably try out options. Best case is see if it crashes or now.
    Thanks
    Mike

    Mikle -- please make sure that you are using either the
    UseParallelGC collector or the UseConcMarkSweepCollector.
    Both would appear to address some of the problems you
    mention.
    You may need to tune the size of the young generation
    explicitly. Check out the GC tuning documents/tips
    at:
    http://java.sun.com/docs/hotspot
    You should make sure your application is not paging.
    Since the default thread stack sizes are large (2 MB?)
    and you may not need that much, you can try -Xss256k
    (for example) to reduce the virtual memory requirements
    for your thread stacks and free up more address space
    for the Java heap.
    In the end, for an application of the kind you describe you
    probably need to go 64-bit and use a larger Java heap
    along with the parallel/concurrent collector to deal with the
    attendant GC overheads. That (going 64-bit) should be easy
    (trivial) if your application is pure Java.
    Hi.
    I am currently running Java 1.5.0 on a production
    server. This server is a 4-cpu 2gb ram beast running
    Red Hat ES 3. It provides MySQL backend and a Java
    server to be accessed through a Flash client.
    So far, the Flash client fares well. MySQL takes worst
    cast 16% of one CPU for very heavy selections. But I
    am having problems with optimizing the Java part that
    does everything.
    First and foremost, I cannot change the way it is. Our
    java code is mostly vendor code, thus we can't really
    expect to be able to easily change the code. Whatever
    code we added to the vendor code is definitely not the
    bottleneck, it's optimized, it's properly synchronized
    and it's very effective.
    I would like to give you an idea of how things fares.
    You will see my problem soon.
    - I am running one process of Java. This process is
    -Xms and Xmx'ed to 384 megs.
    - The total DSize of the Java environment is more than
    a gigabyte due to the 1000+ threads that runs through
    it. More so, every client that runs through it adds up
    at least two threads.
    - There are massive object creation and destruction
    happening. For a 100-client system, the "eden" memory
    is filled up and GC'ed at least twice per second.
    Since 1.5.0, the "old" memory of 384m gets filled up
    in 10 minutes, and GC'ed at that point.
    - CPU usage is having fun between 80% and 150% of one
    CPU (remember I have 4 CPUs so 150% is 150/400% total
    usage)
    - GC is the major speed bump for my server, as if I
    put 768 megs of Xmm instead of 384, cpu usage drops to
    60%-90% CPU, that is, until memory gets filled up and
    swap gets used (do the math: 768m + 1200 thread
    stacks)
    Now it works fine. 100 users, it's perfect. My major
    problem is that from next week on, we are planning
    300+ users. Ouch.
    So my few questions are:
    - In knowing that garbage must constantly be
    collected, is there something I can do in the
    environment to make it happen all the time in
    background? Or am I bound to have all 4 cpu's stopped
    momentarily twice per second so that it might happen?
    - In 1.4.x, I could change "eden" memory block size.
    It doesn't seem to be the same for 1.5.x. What's up
    with that? I used to increase it dramatically, making
    GC longer but less frequent, increasing parallelism
    force.
    I am asking the questions because I am not in position
    of trying "what if"s with my production server. The
    test server handles well our 8 internal users ... but
    we are not close of making the same amount of request
    as our 100-users production server... so we cannot
    reliably try out options. Best case is see if it
    crashes or now.
    Thanks
    Mike

  • Error while reading indesign(.indd) file through COM object in c#

    I want to read InDesign(.indd) file in c#. I have installed adobe InDesignCS6.
    I have added COM reference of 'Adobe InDesign CS6 Type Library' in my c# application.
    Code snippet is as follows.
            [STAThread]
            static void Main(string[] args)
                InDesign.Application app = (InDesign.Application)COMCreateObject("InDesign.Application");
                Document doc = app.ActiveDocument;
                Page page = doc.Pages[1];
                TextFrame frame = page.TextFrames[1];
                Console.WriteLine(frame.Contents.ToString());
            public static object COMCreateObject(string sProgID)
                // We get the type using just the ProgID
                Type oType = Type.GetTypeFromProgID(sProgID);
                if (oType != null)
                    return Activator.CreateInstance(oType);
                return null;
    But the first line itself throwing an following error while type casting output of COMCreateObject method into InDesign.Application type.
    Error :
    Unable to cast COM object of type 'System.__ComObject' to interface type 'InDesign.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{ABD4CBB2-0CFE-11D1-801D-0060B03C02E4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
    Kindly help me. Its urgent.

    try this,
    InDesign.Application app = (InDesign.Application)COMCreateObject("InDesign.Application.CS6");

  • Object creation of string

    Hello
    Please tell me what is the difference between these two object creation of string.
    String str = new String("Hello");.
    String str="Hello";
    Thanks.

    RGEO wrote:
    hello,
    Is the string pool is part of a heap? Huh? I suppose yes, you could regard the String pool as part of the heap... but (I guess) that interned String objects would be placed directly into the permanent generation, which is not garbage collected... and therefore I don't really think of the permanent generation as part of the heap (except when tuning heap allocations)... but I think I'm talking over your noob head here, yes... and so to the noob-stuff.
    If you get bored you might like to scan (for now) http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#generations ... and come back to it in a couple of years time (when every second word isn't new and baffling to you;-)
    jvm what will do when he encounter the following code,
    String s1 = new String ("hello");The VM will:
    1. Create a new String object, and then
    2. copy the characters 'h','e','l','l','o' from the interned String "hello" to the new String,
    3. and then assign a reference to the new String to variable s1.
    Note that the result is subtley different from String s1 = "hello", which just does step 3... it assigns a reference to the existing interned String object "hello" to the variable s1... it does not create and "populate" a new String object.
    Try this just for fun... what is the output of the following program? Why?
    package forums;
    public class StringEquals
      public static void main(String[] args) {
        try {
          String a = "Hello";
          String b = "Hello";
          System.out.println("a==b is "+(a==b));
          String c = new String("Hello");
          System.out.println("a==c is "+(a==c));
        } catch (Exception e) {
          e.printStackTrace();
    }Now, what's the correct way to evaluate equality of String objects in Java?
    HTH. Cheers. Keith.

  • DMS BAPI_DOCUMENT_CREATE2 Class type Technical Document Category, object ty

    Hello Experts!
    The problem is that DMS import functionality stoped working after supp. pack implementation.
    The process is based on BAPI_DOCUMENT_CREATE2 functionality.
    The first problem was an error "The status set requires a previous status" which was causes dy note 1157678
    (http://wiki.sdn.sap.com/wiki/display/PLM/Error-Thestatussetrequiresapreviousstatus)
    After setting break point/de-implementing that note additional error appeared:
    "Class type Technical Document Category, object ty"
    Does anyone have idea what caused the problem, or which sap note did that? before SP19 implementation that error was not displayed.
    Current highest support package is SAPKH60403.
    Thanks in advance for help,
    Rgds,
    LB

    Hi,
    That error refers to updating characteristics for classification (addnl data tab in DIR).
    Does anyone know what could cause the problem after support pack implementation?
    Is it possible that bapi_document_create2 > api_document_maintain2 disables an option to update classification?

  • Production Order Error: "Unable to cast COM object of type 'System.__ComObj

    Hi all,
    I have the following code:
    Dim oProdOrders As SAPbobsCOM.Documents
    oProdOrders = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders)
    after the second line I get a system exception: {"Unable to cast COM object of type 'System.__ComObject' to interface type 'SAPbobsCOM.Documents'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A6DA575B-E105-4585-9F4B-50CC4044EEDD}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."}     
    If I change document to eg oQuotations it proceeds normally.
    Any Idea?
    Thanks in advance,
    Vangelis

    try it as
    Dim oProdOrders As SAPbobsCOM.ProductionOrders
    oProdOrders = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders)

  • Word 2007 COM object

    I am having a heck of a time finding a good example of a word
    COM object. I just upgraded from word 2000 to word 2007, in hopes
    that would suddenly work for me (which honestly I didn't
    expect...). In word 2000, this line worked fine, but not in 2007:
    thisDoc.SaveAs("c:\MyDoc.doc");
    Here is what I am trying to accomplish: I need to use values
    submitted by forms and input it into a word document. The word doc
    needs to have different paragraphs in different formats. I thought
    I could build the paragraphs somehow, with formatting with
    something like para1 = docrange.newparagraph(); then insert the
    text and formatting into para1 and then insert para1 into the
    document. It does not seem to be working at all. If someone can
    link me to a good example I can figure it out from there, but I
    don't seem to be able to find it. Here is my code so far:
    <cfquery name="getAttorney" datasource="agreement">
    Select * from Attorney where ID = #Form.attorney#
    </cfquery>
    <cfoutput query="getAttorney">
    <cfset attornyInfo =
    "#Name#
    #email#
    #Phone#">
    </cfoutput>
    <CFTRY>
    <!--- If it exists, connect to it --->
    <CFOBJECT
    ACTION="CONNECT"
    CLASS="Word.Application"
    NAME="objWordApp"
    TYPE="COM">
    <CFCATCH>
    <!--- The object doesn't exist, so create it --->
    <CFOBJECT
    ACTION="CREATE"
    CLASS="Word.Application"
    NAME="objWordApp"
    TYPE="COM">
    </CFCATCH>
    </CFTRY>
    <CFSCRIPT>
    /* This will open Word if running locally */
    objWordApp.Visible = true;
    /* This returns the 'Documents' collection the Word Object
    thisDoc = objWordApp.Documents.add();
    /* Save the document to a location */
    thisDoc.SaveAs("c:\MyDoc.doc");
    docRange = thisDoc.Range(0);
    docRange.Style=-2;
    docRange.InsertAfter("Header1");
    docRange.InsertParagraphAfter();
    docRange.Style=-3;
    docRange.InsertAfter("I am the paragraph you requested");
    docRange.InsertBreak();
    docRange.InsertAfter("check me out... I'm on the second
    page!");
    para1 = thisdoc.paragraphs.count();
    data = docrange.listparagraphs();
    data1 = docrange;
    /* Save the changes */
    thisDoc.Save();
    /* Close the document */
    thisDoc.Close();
    /* Quit Word */
    objWordApp.Quit();
    </CFSCRIPT>
    <cfdump var="#para1#">
    <cfdump var="#data#">
    <cfdump var="#data1#">
    The dumps do dump information on the related objects, giving
    me methods, puts and gets, but I need more explantion than what is
    actually provided. Para1 used to dump "1" even though I had more
    paragraphs than that in the build. Since I upgraded to 2007, I have
    not gotten it not to error out, I will try to save it as a docx,
    but a doc is really more appropiate for my purposes.
    Thank you for your time.

    The last time I had to deal with a requirement like this,
    which was
    about 2000-2001, we eventually scrapped the word COM thing.
    Even then
    it was such a fragile and perilous solution, fraught with
    problems and
    headaches.
    What we ended up doing, that was much easier, was to create a
    .rtf, rich
    text format, file. We could do all the required formating in
    this
    format, and 90% of the uses would have this file open in MS
    Word and not
    even know they did not get a .doc file.
    How we did it was create a .rtf template with dummy text that
    had all
    the desired formating. Then we could read in the .rtf file,
    which is
    just a marked-up text file, not a binary, and string replace
    the dummy
    text with the dynamic text. Save it again and viola a rich
    text
    formated file with the required content.
    These days, I would push for doing this in PDFs and use
    ColdFusion's
    <cfdocument...> and|or <cfpdf...> functionality.
    But if it has to be
    Word, I suppose it has to be Word.

  • Oracle 8i Lite: Command Object Creation Failed

    Hi Everyone,
    I use Windows XP everything works except navigator and I get the message that Command Object Creation Failed
    Does Anyone know how to fix this and I have to use 8i Lite as it for a school database project
    Thanks in advance for everyone's help
    J S

    Hi. I know this response is too many years late, but I'm putting it in case someone (like me a few days ago) needs to connect to a legacy server using legacy tools:
    This error is caused by the installer, sometimes it does not adequately register the OLE/COM objects provided in nav8cmd.dll
    So, to correct it:
    - open a command window
    - change to the directory where the navigator program files reside (In my case c:\orant\bin)
    - type the following command: regsvr32 nav8cmd.dll
    You should receive a message that the DLL was correctly registered. After that you can use the navigator without problems.
    Cheers.

  • Adobe Plugin not able to access COM object in Protected mode

    We have an adobe plugin for our application. The plugin creates a toolbar button in Adobe and on clicking this button, it invokes one of the form from our application to save the document record for the PDF file in the database. The plugin was working fine till Adobe 9. It stopped working in Adobe X with proctected mode ON. However, if we turn off Protected mdoe, it works fine.
    I did some research and found that we need to modify the policy rules by creating ProtectedModeWhitelistConfig.txt file and appropriate registry for it. I did those steps and now I am not getting "Access denied" error when protected mode is ON but the plugin is still not working. On further debug, I found that it fails while trying to connect to SQL Server. It gives error "SSL Security Error". This is working perfectly fine without protected mode. Also It is not able to access COM objects. I guess both these things might be related.
    Can anyone let me know what are we missing here?

    I would recommend that open a formal support case, as working with Protected Mode is quite complex.

  • Is it possible to restrict the object creation for stateless session beans

    Hi,
    Is it possible to restrict/fix the ejb object creation for stateless session beans in application server?
    For example, i want to configure the application server ( am using JBOSS ) to create maximum of 10 session bean objects. and if any requests for the stateless session bean come, as application server has created 10 objects, the requests should be blocked.
    Thanks in advance,
    nvseenu

    You can keep a counter in the application code. A static var won't work, but an entity and a consistent id should. This version would affect performance, but it would be portable to other app servers.
    // ConstrainedBean.java
    package unq.ejb;
    import javax.ejb.Stateless;
    import javax.ejb.CreateException;
    import javax.annotation.PostConstruct;
    import javax.annotation.PreDestroy;
    import javax.persistence.PersistenceContext;
    import javax.persistence.EntityManager;
    @Stateless
    public class ConstrainedBean implements Constrained {
        final static int DEFAULT_COUNTERID = 1;
        @PersistenceContext EntityManager em;
        @PostConstruct
        protected void init() throws CreateException {
         ConstrainedBeanCounter counter =
             em.find(ConstrainedBeanCounter.class, DEFAULT_COUNTERID);
         if( counter == null ) {
             counter = new ConstrainedBeanCounter();
             counter.counterId = 1;
             counter.counterValue = 0;
             em.persist(counter);
         if( counter.atMaximum() ) {
             throw new CreateException("error attempting to create > 10 beans");
         else {
             counter.increment();
        @PreDestroy
        protected void destroy() {
         ConstrainedBeanCounter counter = em.find(ConstrainedBeanCounter.class,
                                   DEFAULT_COUNTERID);
         counter.decrement();
        public void doSomething() { System.out.println("doSomething()"); }
    // ConstrainedBeanCounter.java
    package unq.ejb;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    @Entity
    public class ConstrainedBeanCounter implements java.io.Serializable
        @Id public int counterId;
        public int counterValue = 0;
        public void increment() {
         counterValue++;
        public void decrement() {
         counterValue--;
        public boolean atMaximum() {
         return counterValue > 9;
    }

  • Connecting to COM objects

    Hi everyone,
    I've got a project on the horizon that involves using an API to access a database. The API uses COM objects. 
    Can I connect to the API using <cfobject> like this:
    <cfobject 
        class = "program ID"
        name = "myneatobject"
        action = "connect"
        context = "remote"
        server = "http://someserverip">
        type = "com">
    If the server is remote, isn't there some security involved? Login credinentials?  I'm trying to ge my head around this.  There's an exisiting website in place using the API, however we're planning on redoing everything in CF. 
    Thanks for any tips in to set me straight!

    Thanks Guys.
    To be sure I'm describing this properly, I've got the manual for the API (updated in 2009) and it states
    "The  API is a COM+ application (formerly MTS). It
    provides a set of COM objects that can be manipulated by COM-
    compliant development tools such as Visual Basic, Visual C++, Visual
    C#, VSTA and so on.
    The API provides the ability to search and locate accounts across
    multiple  databases. It uses an advanced data cache mechanism to
    minimize round-trips to database servers.
    Once the account is located using a 10-digit telephone, and
    optionally an account number, each subsequent attempt to connect to an
    database requires a company number as well as a valid account
    number."
    The following example shows how to modify an existing user profile information:
    Dim objUserProfile as Object
    Dim lRetCode as Integer
    Set objUserProfile = CreateObject("EnergyAPI.cUserProfile")
    lRetCode = objUserProfile.ModifyUserInfo (sEmailAddress,
    sPassword,sName,sPAsswordHint,sHintAnswer,lPreferences,cSysUser)
    If lRetCode <> 0 Then
      ‘ Failure - Display error message
      Else
        ‘ Success
      End If
    COM+ much different than COM?? Not from what I'm reading.

  • How sharing a COM object with severeal test dlls in teststand

    I have several tests (dlls) accessing a DAQ board (not VI compliant) thanks to a COM object. I would like to keep one instance of this object, passing its reference to each test dll, instead of creating one in each test. How can I do that with TestStand?

    You can do one of two things to store a reference to the COM object in the context of TestStand so that you can pass it to successive steps in order for them to all use the same object instance.
    First, if you create the object in TestStand with an ActiveX Automation Adapter step, the method call to instantiate the object should return a reference to the object. If you designate an activex reference type local variable as the property to receive the reference during the creation operation, you should be able to pass this into methods that use IDispatch* parameters, or you can use the TestStand API to access the TestStand variable instead.
    The second scenario is very similar, in that if you don't create the object in TestStand but inside of a dll instea
    d, you can simply pass the parameter back from a function into a TestStand activex reference property variable or use the TestStand API inside of the dll to set the value of an activex reference property to the IDispatch of the object.
    To better understand how to use the ActiveX Automation Adapter and ActiveX Reference Variable Types, look at Chapter 13 of the TestStand User Manual under the section entitled "ActiveX Automation Adapter". I have also attached an example to this post that uses the ActiveX Automation Adapter and ActiveX reference datatype in a sequence that writes data to a Microsoft Excel spreadsheet and generates a chart from the data.
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask
    Attachments:
    Write_Table_to_XL_and_Create_Chart.seq ‏53 KB

  • Frequent Object Creation vs. synchronized

    HI all,
    I'm just looking to prompt a discussion I can learn from. Apologies if I'm missing something.
    Having just read the excellent articles over at:
    http://www-106.ibm.com/developerworks/java/library/j-threads1.html
    http://www-106.ibm.com/developerworks/java/library/j-threads2.html
    http://www-106.ibm.com/developerworks/java/library/j-threads3.html
    I was left wondering about the (largely unmentioned) trade-off between object creation and use of synchronization.
    If a particular part of a given system is heavily accessed then one might consider instantiating, and caching references to, components in an initialisation stage. In a multithreaded environment, this can obviously pose a problem.
    If these components aren't threadsafe then at some point use will have to be made of a synchronized block, unless the unsafe components are instantiated for every thread.
    The articles do mention the overrated cost of synchronization - how does this compare with the cost of frequent object instantiation?
    Thanks for your time,
    JohnG

    Well, let's time it (test program below):
    using no synchronization: 180 ms (baseline measurement, not thread safe)
    using new: 1111 ms
    using uncontended sync: 491 ms
    using contended sync: 49531 ms
    new is fast - ten million temporary object allocations and frees per second. A magnitude faster than in traditional malloc()/free() -based languages. new is rarely a performance problem in Java programs.
    Uncontended locks are fast - twenty million per second.
    Heavily contended locks slow you down. Way down. A second becomes a minute.
    Don't try to optimize unless you have measured a real performance bottleneck.
    Object pooling is unlikely to help. Exceptions being objects that are expensive to initialize and are created often (e.g. large buffers or arrays, cryptographic engines that take time to initialize, or connections to external systems such as databases). You'll need to measure first if object creation really is the bottleneck.
    public class t
        static class Calculator
         private int value;
         void initialize(int n)
             value = n;
         int result()
             return value * 2;
        static class NewThread
         extends Thread
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              Calculator x = new Calculator();
              x.initialize(n);
              result += x.result();
        static class SyncThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              synchronized (x) {
                  x.initialize(n);
                  result += x.result();
        // Not thread safe
        static class BaselineThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              x.initialize(n);
              result += x.result();
        public static void main(String args[])
         throws Exception
         int thread_count = 10;
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new BaselineThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using no synchronization: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new NewThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using new: " + (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new SyncThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using uncontended sync: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new SyncThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using contended sync: " +
                          (end - start) + " ms");
    }

Maybe you are looking for

  • Unable to update my iphone 4s ios to 5.0.1

    dear friends im experiencing updating problem rite now. i just bought a 4s for my wife yesterday. when i tried updating the ios to 5.0.1 directly from the phone, it showed - 'Unable to Check for Update. An error occured while checking for a software

  • Explain: how to include Infospoke in Process Chain where destination is  DB

    Explain: how to include Infospoke in Process Chain where destination is  local machine database [NOT Flatfile]

  • Problem to open photos in E7

    When I try to open photos in my E7, I will only have the black screen. I can take photos but I am not able to see photos .  I have reinstalled the software but nothing helps. Ovi Suite problem: MTP USB DEVICE FAILURE, what this means? Solved! Go to S

  • Asset master Error in LSMW

    Hi All, I am uploading assets for a new company purchased by us in company code 2222, which uploading the data by using lsmw we are getting the following error message. We checked in customization that there is a date mentioned in legacy transfer dat

  • VSM Login Exception: oracle.otnsamples.util.UtilityException

    Hello, I am trying to execute the sample VSM application using JDK 1.5. Using ANT to build the application on oc4j -oracle application server containers for J2EE 10g (9.0.4.0.0). When I run the application, the login frame throws the following error