none
Getting server crash by a VC++ Dll(Written in MFC programming of VC ++) in web archive(war)when application server(JbossEAP) is running from windows services while same works absolutely fine by running server from bat file. RRS feed

  • Question

  • Environment: - 

    Operating System: Windows 10

    Dll Written: VS 2008

    Dll Used By: - A war (web archive) file written in J2EE and call dll by native keyword

    Application Server: - Jboss EAP 7.1 and it can start from both .bat file or windows service

    Description: -

    We have a web application program which is deploying on an application server: Jboss EAP and on a web page, we are calling Dll method by native keyword. This Dll is written in MFC programming of VC ++ for achieving and replace some string in word template and it is working fine when server is running from bat file.

    When JbossEAP server is running from services (Windows Service), server is getting crashed. And the line where server is getting crashed, it is inside the Dll, i.e. Dll code is calling, but something is missing and due to that program is terminating jvm and server crashed.

    Code snippet where program is crashing: -

    _Application oAppObj;

    _Document oActDoc ;

    if(!oAppObj.CreateDispatch(_T("Word.Application"),&e))

    {

                _stprintf(buf, _T("Error on CreateDispatch() : %ld (%08lx)"),e.m_sc, e.m_sc);

                Log(WDPROJ_CANNOT_OPEN_WORD,_T(""),_T(""),_T("Cannot open the word object."));

                return WDPROJ_CANNOT_OPEN_WORD;

    }

    oAppObj.m_bAutoRelease = true;

    Documents oDocs = oAppObj.GetDocuments();

    Log(0, _T("OPENING_WORD_DOCUMENT"), _T("PROCESSING"), _T(""));          

    // Server crashed on below highlighted line

    oActDoc=oDocs.Open(COleVariant(strTmpFileName),covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional);

    oDocs.m_bAutoRelease =true;

    Log(0,_T("OPEN_WORD_DOCUMENT_TASK"),_T("COMPLETED"),_T(""));

     

    Error captured in Event viewer logs when server crashed: -

    Event Logs: -

    Faulting application name: java.exe, version: 8.0.1810.13, time stamp: 0x5b40a072

    Faulting module name: MSVCR90.dll, version: 9.0.30729.9247, time stamp: 0x56fa3839

    Exception code: 0xc0000417

    Fault offset: 0x00000000000552d4

    Faulting process id: 0x1114

    Faulting application start time: 0x01d5a5cf78a953f3

    Faulting application path: C:\Program Files\Java\jdk1.8.0_181\bin\java.exe

    Faulting module path: C:\windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9247_none_08e394a1a83e212f\MSVCR90.dll

    Report Id: 2ce9dd98-718b-4f41-8405-85c7ff940116

    Faulting package full name:

    Faulting package-relative application ID:

    Kindly assist me to resolve the issue. I will be really thankful.



    Regards, S.P Singh


    • Edited by S.P Singh Friday, December 6, 2019 9:14 AM
    Friday, December 6, 2019 9:12 AM

Answers

  • See https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office

    It states --

    All current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended.

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    • Marked as answer by S.P Singh Monday, December 16, 2019 6:24 AM
    Friday, December 6, 2019 10:59 AM
  • C0000417 (your original error) is STATUS_AFFINITY_NOT_COMPATIBLE.  C0000409 (your new error( is STATUS_STACK_BUFFER_OVERRUN.

    What you're doing isn't supported.  Honestly, it doesn't matter how bad you want it.  It can't be done, and Microsoft's not going to make it happen.

    There are lots of third-party libraries for creating and manipulating Word documents without using the actual application.  You need to look into those.  Or, depending on what you're doing, perhaps you would be better off generating a PDF file, or perhaps even the OpenOffice .ODT format, which word is able to open.

    The point is, you need to find another way.  What you're doing is a dead-end.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    • Marked as answer by S.P Singh Monday, December 16, 2019 6:24 AM
    Friday, December 13, 2019 10:50 PM

All replies

  • Hello,

    please provide more Information. Your class "Document" is neither an MFC nor a Standard C++ class.

    I don't see why a simple call to a member function "Open" in class "Document" should fault. A call to a member function can fail when for example the stack memory is too small and you define too many variables on the stack in the function "Open". But since it works in another environment, I don't think it is a source code problem.

    Everything is guessing with the information that you have given so far.

    Please show us relevant code snippets of (at least) your class "Document" and the function "Open".

    Regards, Guido

    Friday, December 6, 2019 9:29 AM
  • See https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office

    It states --

    All current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended.

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    • Marked as answer by S.P Singh Monday, December 16, 2019 6:24 AM
    Friday, December 6, 2019 10:59 AM
  • In project, I checked following files are including

    msword9.h

    msword9.cpp

    Below methods are mention in msword9.h and referring to msword operation : - 

    Documents oDocs = oAppObj.GetDocuments();

    Log(0, _T("OPENING_WORD_DOCUMENT"), _T("PROCESSING"), _T(""));          

    // Server crashed on below highlighted line

    oActDoc=oDocs.Open(COleVariant(strTmpFileName),covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional,covOptional);


    Regards, S.P Singh



    • Edited by S.P Singh Friday, December 13, 2019 10:29 AM Formatted
    Monday, December 9, 2019 3:37 PM
  • After building Dll from VS 2019, error has changed and we are getting following exception

    Faulting application name: java.exe, version: 8.0.1440.1, time stamp: 0x5972dd89
    Faulting module name: ucrtbase.DLL, version: 10.0.14393.2990, time stamp: 0x5caeb96f
    Exception code: 0xc0000409
    Fault offset: 0x000000000006cba8
    Faulting process id: 0xaf8
    Faulting application start time: 0x01d5b0a355865ac1
    Faulting application path: C:\Program Files\Java\jdk1.8.0_144\bin\java.exe
    Faulting module path: C:\Windows\SYSTEM32\ucrtbase.DLL
    Report Id: 391fffde-1c97-11ea-827f-b083fea56825
    Faulting package full name: 
    Faulting package-relative application ID: 


    Regards, S.P Singh

    Friday, December 13, 2019 11:21 AM
  • After building Dll from VS 2019, error has changed and we are getting following exception

    Faulting application name: java.exe, version: 8.0.1440.1, time stamp: 0x5972dd89
    Faulting module name: ucrtbase.DLL, version: 10.0.14393.2990, time stamp: 0x5caeb96f
    Exception code: 0xc0000409
    Fault offset: 0x000000000006cba8
    Faulting process id: 0xaf8
    Faulting application start time: 0x01d5b0a355865ac1
    Faulting application path: C:\Program Files\Java\jdk1.8.0_144\bin\java.exe
    Faulting module path: C:\Windows\SYSTEM32\ucrtbase.DLL
    Report Id: 391fffde-1c97-11ea-827f-b083fea56825
    Faulting package full name: 
    Faulting package-relative application ID: 


    Regards, S.P Singh

    Hello,

    normally speaking, this is a Windows system error. There are many postings in the web about ucrtbase.dll faults. Maybe updating Windows 10 or Java can solve the problem.

    I don't think it is a source code problem. Maybe you should better ask here for further help: https://answers.microsoft.com/en-us/windows/forum/windows_10

    If you think it is a source code problem, then check with the debugger or dump file where the fault occurs in the source code. http://www.windbg.org/

    Regards, Guido

    Friday, December 13, 2019 11:39 AM
  • The programmer called tech support and said, "My program crashes when I automate Word from a windows service."

    The answer was, "Microsoft has warned for years that this is unsupported and that Office may exhibit unstable behavior or deadlock.  Don't do that."

    Friday, December 13, 2019 11:40 AM
  • Dear RLWA32,

    I appreciate, but currently client wants to use this feature from services, so we need to fix it. I  will search some alternate way to accomplish this later on.


    Regards, S.P Singh

    Friday, December 13, 2019 11:51 AM
  • Dear RLWA32,

    I appreciate, but currently client wants to use this feature from services, so we need to fix it. I  will search some alternate way to accomplish this later on.


    Regards, S.P Singh

    Perhaps if you direct your client to the Microsoft guidance in the link contained in my earlier post they will understand that they should reconsider this feature.
    Friday, December 13, 2019 11:55 AM
  • C0000417 (your original error) is STATUS_AFFINITY_NOT_COMPATIBLE.  C0000409 (your new error( is STATUS_STACK_BUFFER_OVERRUN.

    What you're doing isn't supported.  Honestly, it doesn't matter how bad you want it.  It can't be done, and Microsoft's not going to make it happen.

    There are lots of third-party libraries for creating and manipulating Word documents without using the actual application.  You need to look into those.  Or, depending on what you're doing, perhaps you would be better off generating a PDF file, or perhaps even the OpenOffice .ODT format, which word is able to open.

    The point is, you need to find another way.  What you're doing is a dead-end.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    • Marked as answer by S.P Singh Monday, December 16, 2019 6:24 AM
    Friday, December 13, 2019 10:50 PM