PrintToPrinter() crashes windows service

Hi,
We have a windows service written in VB.NET using Crystal Reports 2008 SP2 (latest fix pack has also been applied).
It is a multithreaded solution that generates and prints reports from an Oracle 10 db.
The loading and printing of the reports are done in different threads so the interaction with the CR
runtimes could in theory occur at the same time from 3 different threads.
The printers that are used are network printers (from a print server) but they are added ("installed") on the server
running the windows service.
Our problem is that an unhandled exception (unmanaged I guess) is quite often thrown after
calling the method PrintToPrinter() which brings the whole windows service down and leaves
a general error message in Event Viewer:
.NET Runtime 2.0 Error
"Faulting application "myapp.exe", version 1.0.0.0, stamp 461c7030, faulting module ntdll.dll, version 5.1.2600.2180, stamp 41109655, debug? 0, fault address 0x00018fea."
(The "faulting module" is not allways the same but most often ntdll)
We haven't found any way to catch this exception. We have error handlers in all threds and we have also tried to
add a global unhandled exception handler for UnhandledExceptions without any luck.
I'm aware of the fact that (introduced in .NET framework 2.0) this behaviour to bring down the current app is "by design" if an unhandled exception is thrown and not caught in a thread of the current app domain.
It seems that the application crash much more frequently when PrintToPrinter() is called at the same time from at least two of the app's threads.
We also had problems with the same app before upgrading to CR 2008 from the version of CR that comes with VS 2005.
The problem was exactly the same except that when calling the PrintToPrinter() method the thread hanged and never returned instead of crashing the entire app.
I assume the exception is thrown when CR is communicating with the print drivers but how to proceed?
Are there any logging done by the CR runtime?
Is there anyway to debug the CR runtime?
Anyone have experienced anything similar?
More info:
OS: Windows Server 2003
.NET Framework: 2.0
CR: Crystal Reports 2008 SP2 (latest fix pack)
DB: Oracle 10
Printers: Mostly HP LaserJet 4350
/jiijiijii

Another option would be to use RAS to print your report, seems to work better than PrintToPrinter:
               System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
            CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptionsClass();
            CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions newOpts = new PrintOptionsClass();
               pDoc.PrinterSettings.PrinterName = cboCurrentPrinters.Text;          
               rasPROpts.PrinterName = cboCurrentPrinters.Text;               
               rasPROpts.PaperSize = (CrPaperSizeEnum)
                    pDoc.PrinterSettings.PaperSizes[cboCurrentPaperSizes.SelectedIndex].Kind;
               rasPROpts.PaperSource = (CrPaperSourceEnum)
                    pDoc.PrinterSettings.PaperSources[cboDefaultPaperTrays.SelectedIndex].Kind;
               CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperSourceEnum.crPaperSourceManual;
            rasPROpts.JobTitle = "MYPrintJob";
               rptClientDoc.PrintOutputController.PrintReport(rasPROpts);
               MessageBox.Show("Printing report.", "RAS", MessageBoxButtons.OK,MessageBoxIcon.Information );
Thank you
Don

Similar Messages

  • Oracle 9i simulating a windows service crash

    Hello all,
    I know this may be a bit fetched... I am trying to simulate a windows service crash in order to test a debug diagnostic software ( debug diagnostic ) on our W2003 server.
    We have been experiencing random crashes of the windows Oracle service and I am trying to evaluate if this debug tool is will work for diagnosing my issue.
    My question is how I can make the windows process crash via a db script which will eventually halt the DB.
    Any ideas? much appreciated.
    J

    Johnny R. wrote:
    Hello all,
    I know this may be a bit fetched... I am trying to simulate a windows service crash in order to test a debug diagnostic software ( debug diagnostic ) on our W2003 server.
    We have been experiencing random crashes of the windows Oracle service and I am trying to evaluate if this debug tool is will work for diagnosing my issue.
    My question is how I can make the windows process crash via a db script which will eventually halt the DB.
    Any ideas? much appreciated.
    JMaybe I'm being overly simplistic, but since it's Windblows, why not just open task manager and kill the process?

  • Windows Servics Crash *$&@^#

    After reimaging about 30 XP machines and at the end of the night it decied not to let my test user log in telling me that the domin was not available. So I restarted the windows services and then updated to 10.4.6 Still nothing works. I can log in a machine locally and connect & authenticate to the server and map a drive. But it will not let me log into the domain. I have tried everything. Here is a copy of my Windows File Service Log:
    netbios connect: name1=OHS name2=OHS-B1
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/smbd/reply.c:reply_special(242)
    netbios connect: local=ohs remote=ohs-b1, name type = 0
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/smbd/sesssetup.c:setupnew_vcsession(662)
    setupnew_vcsession: New VC == 0, if NT4.x compatible we would close all old resources.
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/lib/module.c:dosmb_loadmodule(63)
    Module '/usr/lib/samba/auth/opendirectory.so' loaded
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/smbd/sesssetup.c:setupnew_vcsession(662)
    setupnew_vcsession: New VC == 0, if NT4.x compatible we would close all old resources.
    [2006/04/18 20:46:19, 0] pdbods.c:odssamgetsampwnam(2329)
    odssam_getsampwnam: [0]getsam_recordattributes dsRecTypeStandard:Users no account for 'unknown'!
    [2006/04/18 20:46:19, 1] /SourceCache/samba/samba-92.19/samba/source/auth/authutil.c:make_server_infosam(826)
    User unknown in passdb, but getpwnam() fails!
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/auth/auth.c:checkntlmpassword(367)
    checkntlmpassword: Authentication for user [] -> [] FAILED with error NTSTATUS_NO_SUCHUSER
    [2006/04/18 20:46:19, 0] pdbods.c:odssamgetsampwnam(2329)
    odssam_getsampwnam: [0]getsam_recordattributes dsRecTypeStandard:Users no account for 'unknown'!
    [2006/04/18 20:46:19, 1] /SourceCache/samba/samba-92.19/samba/source/auth/authutil.c:make_server_infosam(826)
    User unknown in passdb, but getpwnam() fails!
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/smbd/sesssetup.c:setupnew_vcsession(662)
    setupnew_vcsession: New VC == 0, if NT4.x compatible we would close all old resources.
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/smbd/sesssetup.c:setupnew_vcsession(662)
    setupnew_vcsession: New VC == 0, if NT4.x compatible we would close all old resources.
    [2006/04/18 20:46:19, 0] pdbods.c:odssamgetsampwnam(2329)
    odssam_getsampwnam: [0]getsam_recordattributes dsRecTypeStandard:Users no account for 'unknown'!
    [2006/04/18 20:46:19, 1] /SourceCache/samba/samba-92.19/samba/source/auth/authutil.c:make_server_infosam(826)
    User unknown in passdb, but getpwnam() fails!
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/auth/auth.c:checkntlmpassword(367)
    checkntlmpassword: Authentication for user [] -> [] FAILED with error NTSTATUS_NO_SUCHUSER
    [2006/04/18 20:46:19, 0] pdbods.c:odssamgetsampwnam(2329)
    odssam_getsampwnam: [0]getsam_recordattributes dsRecTypeStandard:Users no account for 'unknown'!
    [2006/04/18 20:46:19, 1] /SourceCache/samba/samba-92.19/samba/source/auth/authutil.c:make_server_infosam(826)
    User unknown in passdb, but getpwnam() fails!
    [2006/04/18 20:46:19, 2] /SourceCache/samba/samba-92.19/samba/source/smbd/server.c:exit_server(595)
    Closing connections
    Any help would be great.
    Scott Smith

    Here are all the files.
    In addition, I removed all the unnecessary stuff from the code.
    I have no reason to believe the crash occurs due to anything but the labview, because there is absolutly nothing else on the computer besides the OS.
    and this error keeps hapening only when I run the program
    Thanks again.
    Attachments:
    Controller and Syringe pump.vi ‏35 KB
    Eurotherm 32xx Series.zip ‏1045 KB
    NE-50X.zip ‏1012 KB

  • Setting up OIM to start as a Windows Service running under Weblogic 10.3.2

    Hi,
    On recommendation from our Oracle Rep. we have begun migrating our existing OIM installation on Oracle AS to a Weblogic Application Server. As such we are looking for a way to get the OIM application to run as a service in windows - so we dont have to start it manually after a reboot and so that system monitoring can alert us if/when the application crashes for some reason.
    I have asked Oracle support - which basically said that no such howto/documentation exists and that "One needs to debug on their own when face any issue." (whatever the h*** that means).
    I was thinking that we werent the first customers trying to get the OIM webapplication to start automatically under weblogic and that someone must have figured out a way to accomplish this ?
    Any advice on how to do this will be greatly appreciated.
    Thank you in advance.
    /Jacob

    Hi Jacob,
    See this post that I answered few time ago. Re: Keeping Remote Manager running - Windows
    Our OIM is running as a Windows Service.
    REnato

  • Application runs but not as a Windows service oracore

    I have a weird problem and I was hoping somebody might be able to help me. I have an application that we developed that uses an Oracle database. The application can be run in user mode(double clicking on the file) or as a Windows service. We have always used the Oracle Database client to connect to the Database in user mode and it has worked. Using the same configuration we were able to run our application as a service and it has always worked. The problem now is that if we use a newer Oracle Client (>= 10.2) it will not work as a service. When I say it doesn't work I mean that the application never starts and the Windows Event Viewer log states an APPCRASH in oracore10.dll or oracore11.dll.
    It doesn't seem to matter which database we use, 10G, 11G, because if we use the 10.1 version of the Oracle Database Client to connect to these databases it works. However if we use any client>=10.2 the application crashes.
    Any suggestions?
    Edited by: 945875 on Jul 11, 2012 1:45 PM

    So I stopped any Oracle windows services that were running, deleted the only oracle directory on the machine, and reinstalled 11.2 client. The same results occur, I can connect to and start my application in user mode but not as a service. I checked the version# of OCI.dll, 1 instance of it on the machine, and it does state that it is version 11.2.0.1. The setup I have is:
    Machine 1: Server 2008 R2
    Oracle 11g database
    Oracle 11g client
    my application
    Machine 2: Windows 7 64-bit
    Oracle 11g client
    my application
    I get the exact same results if I try to run my application on the same machine as the database (machine 1) or across the network (machine 2).
    I've setup the connection using Oracle Client's Net Configuration Assistant, added the Local Net Service Name Configuration, and am using TCP. At the end of the Local Net Service Name Configuration I get "Success" when talking to the database.
    Thank you for any help you might be able to provide.

  • Windows Services not working, nmbd stopping

    Hi all,
    I encounter a strange problem.
    I'm currently trying to install a Mac OS X Server System on a Xserve and XRaid. This to remove a Win2K Server with AD on and Exchange working on it.
    I set my server in OD master, import accounts from the AD, replaced Exchange with Kerio etc ...
    But when i try to use Windows services, smbd always working fine (file sharing is ok), nmbd stopping. So i can't use it as a PDC server because the domain i create disappears with the crash of the nmbd process. In fact nmbd seems to stop after nmblookup requests.
    I've to say that the Win2K server is not stopped.
    I installed lots of OS X Server as Windows PDC and it has always been working fine.
    I also tried to activate Windows Service as "linked to Active Directory" and as "Standalone Server" and it resulted the same issue.
    Does anyone had an idea ? I thought that it could be a problem with the Win2K requests and crashing my nmbd with nmblookup.

    I'll try these things tomorrow to see what happens :
    - Change the "os level" setting to something high in /etc/smb.conf . (because of the Win2K Server).I'll set this to 255.
    1. Make sure that DNS is running on your server. Make sure that the server has a dns entry for itself.
    2. Ideally "Workgroup Master Browser" and "Domain Master Browser" should both be enabled. An aside, this did not interfere with my seperate AD domain on the same network.
    3. Enable WINS on your server.
    4. Configure WINS on Windows clients to point to server.

  • Can't  upgrade I tunes because of problems with Windows Service Pack 2

    My daughter and I got shuffles for Christmas. I am unable to upgrade to the necessary version of I tunes because I do not have SP2. When I try to download the windows service pack 2 my computer crashes. Any suggestions? Are there any ways around this?

    Hi there
    It could be that this particular file has some corruption. It could also simply be that the number of objects in the file is somewhat taxing your PC resources.
    You might try what is outlined in the link below and see if it helps anything.
    Click here to read
    The post you are likely interested in was made by Jayashree and involves tweaking a setting in the Windows Registry.
    Cheers... Rick
    Click here for Adobe Certified Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Airport extreme with windows service pack 2

    I have just recently bought a macbook pro laptop, & have been corresponding with a forum member about a wireless setup.
    I want to have a wireless set up with a PC desktop with windows xp home service pack 2 that is stationed in the kitchen. This was recommended to me in this forum. Right now the PC has an Ethernet black box, with at&t DSL service. It has one yellow Ethernet cable coming from the black box to the PC & one grey DSL cord coming out of the black box & connects to a phone in the kitchen. I bought the laptop for my online classes so steady reliable internet service is crucial. Upon reading the specs of the airport extreme however got me a little concerned about which service pack I can use.
    Here is my question & comment from another member on this forum;
    I just noticed a PC has to have windows service pack 3, I have service pack 2, will it work with service pack 2? I am reluctant to update to service pack 3, my story behind my reluctance; the last time I did it, my PC completely crashed, the hard drive died. It had to be replaced, & ever since I get a little yellow alert to update to service pack 3, but I have not done it out of fear of another meltdown. Right now it is the only computer in our house, & I need it for my online classes. Last summer when I tried the service pack 3 update, & subsequent PC meltdown, I had to go to a public computer lab to finish off an online class, so I do not want to go through this again.
    And this is what they said;
    +That will give you wired internet access at the PC. Of course, the MacBook Pro will be wireless. I am not sure about the technical specifications required for the Airport. My initial reaction is that you should be fine to use the Airport as just a router with the PC with Service Pack 2. I think SP3 is just required for administration of the Airport using the Airport Utility for Windows. But, you could administer the Airport with your MBP. You may want to confirm this in the Airport forum unless somebody else here knows for sure! Sorry!+

    Which would be more powerful & reliable? the newest airport extreme or the aiport with the 500GB time capsule?
    Again, it will depend on what your networking requirements are. If we are talking about support for Time Machine backups, then only the Time Capsule (of the two options you listed) would work. Apple doesn't currently support these backups to drives attached to the AirPort Extreme Base Station.
    Would I be better off with something that is just for wireless internet? or a combo unit time capsule & airport?
    If you don't have any networking gear now, then it may make better sense to go with a combination unit.

  • Ifolder client as a windows service

    client request, is it possible to run the ifolder client as a windows
    service so we can sync a windows "file server" pc to ifolder without logging
    in after a reboot?
    I guess this would be similar to running DropBox as a service
    http://superuser.com/questions/41992...x-as-a-service
    anybody tried this? or have any experience?
    many thanks
    Simon

    I have used many app as a service so the app doesn't interact with a desktop by using srvany which is included in the Windows Server 2003 Resource Kit Tools.
    Although i have more recently moved to nssm almost a direct drop in replacement because it has better error handling of crashed apps that it is running as a a service.
    Check it out here
    https://iain.cx/src/nssm/
    Originally Posted by Simon Shilton
    client request, is it possible to run the ifolder client as a windows
    service so we can sync a windows "file server" pc to ifolder without logging
    in after a reboot?
    I guess this would be similar to running DropBox as a service
    windows home server - How to configure Dropbox as a service - Super User
    anybody tried this? or have any experience?
    many thanks
    Simon

  • 10.3 registering Admin and Managed server as windows service.

    I have not found anything in the new documentation on how to do this which left me wondering if there is a reason it was omitted? I found procedures from the 8.1 docs but would rather have something more up to date. I'm installing on win 2003 server. Thank you.
    Edit: I found the installSvc.cmd script in the %wlshome%\server\bin directory and tried it. According to instructions you set SERVER_NAME and then call the script. It seems to install the services ok but when I start them they stop immediately with no specific errors in event viewer.

    Dear,
    I assume you now have at least 3 windows services:
    -node manager service
    -adminserver service
    -1 or more service for your managed servers (which start after adminserver service)
    All of them start on system startup.
    My question: If let's say one managed server crashes, is it then automatically restarted by the nodemanager? Since the managed server is not started by node manager itself, I guess the answer is no. If so, what is the usage of having nodemanager running as a service?
    Thanks.

  • Application Restart and Recovery APIs doesn't work for windows services

    I am using the Application Restart and Recovery mechanism (provided in Windows API Code Pack for Microsoft.NET Framework) to collect some information (i.e. stack information when there's an unhandledexception)  before my windows service crash down.
    It works well for windows form applications, but the callback method wouldn't be called if the host is a windows service. 
    I have checked the article: https://msdn.microsoft.com/zh-cn/subscriptions/downloads/cc303708
    But it doesn't specify clearly whether it works for a windows service. It seems that the recovery will only be activated when the user interacts with the error dialog of Windows Error Reporting (clicking "close" on the dialog, for example).
    So I am wondering is my guess right that the Application Restart and Recovery mechanism doesn't work for windows services. Or is there a better way to meet my requirement? 

    I would suggest trying ARR if that's what you want to use.  The restart portion won't work, but it doesn't need to as if you fail out of your service, the Windows service controller will handle recovery (up to and including restarting your service).
     You configure those recovery actions either through code or one of the built in administrative tools for services such as services.msc.  
    DebugDiag/ADplus and similar tools ultimately do use built-in APIs; you don't need to add anything external to collect debugging information.  You do however have to write a good deal of code to do somethings.  It's pretty simple to use the unmanaged
    function that I pointed out before and
    MiniDumpWriteDump to write a minidump when you hit an unexpected error(the dbghelp.dll that comes installed with Windows has it so you don't need anything additional installed).  You can even write a basic debugger that literally debugs a process using
    only kernel32 functions (see
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms679301(v=vs.85).aspx if you're interested).  
    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

  • Call to Table.SetDataSource() causes FileLoadException in Windows service

    I'm porting code toVS2010/Crystal Reports VS2010 that has worked flawlessly 24/7 for the past 2 years.  Original code used VS2008/CR VS2008.
    I generate reports from a background Windows service using Crystal Reports.  I have a set of report generation CR components that work in a variety of contexts - WinForms apps, console apps and the Windows service.
    When I ported to VS 2010, all of my apps worked fine, except for the Windows service.  In the service, the first call to Table.SetDataSource() causes the service to crash.  I've used detailed logging in the service to pinpoint the source of the error.  I log before and after the call to SetDataSource(), but only the before message is logged.
    VS2010 version - 10/0/30318.1 RTMRel
    CR VS2010 runtime version - 13.0.2000.0
    I see the following in the 'Application' event log after this happens:
    =======================
    EventType clr20r3, P1 usastudiosservice.exe, P2 1.0.4065.17651, P3 4d5d3537, P4 mscorlib, P5 4.0.0.0, P6 4ba1da6f, P7 2463, P8 0, P9 system.io.fileloadexception, P10 NIL.
    =======================
    Application: UsaStudiosService.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.IO.FileLoadException
    Stack:
       at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean, Boolean)
       at System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean, Boolean)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean, Boolean)
       at System.Reflection.RuntimeAssembly.InternalLoadFrom(System.String, System.Security.Policy.Evidence, Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)
       at System.Reflection.Assembly.LoadFrom(System.String)
       at CrystalDecisions.ReportAppServer.DataSetConversion.DataSetConverter.DataSetProcessingDelegate(IntPtr)
    ======================
    I'm catching all exceptions in my report generator component, but, for some reason, this exception isn't caught.  I think it's because it's occurring in the CLR and the CLR is aborting the process.
    I've been monitoring the service in ProcMon. I see a final set of  references to the CrystalDecisions.ReportAppServer.DataSetConversion assembly that succeed, 3 attempts to access the assemby's PDB file that fail, and then DW20.EXE (C:\Program Files\Common Files\Microsoft Shared\DW\DW20.EXE) is loaded to process process the error.  (Could the missing PDB file be the problem?)
    The ProcMon trace looks entirely different when I run the report gen components from the WinForms and console apps.
    I don't think this is a permissions issue.  I've been able to log in as the user that the service logs in as and have been able to run both WinForms and console versions of the report generator without problems.
    Any help would be greatly appreciated. I absolutely have to convert this app!
    -David

    Sorry about that,
    They changed the info... Do this:
    In the mean time here's how to work around it and get logging working:
    Create a Registry file with this in it and save it: ( Replace the double quote with an open square bracket )
    W i n d o w s R e g i s t r y E d i t o r V e r s i o n 5 . 0 0
    " H K E Y _ L O C A L _ M A C H I N E \ S O F T W A R E \ S A P B u s i n e s s O b j e c t s \ S u i t e X I 4 . 0 ]
    " H K E Y _ L O C A L _ M A C H I N E \ S O F T W A R E \ S A P B u s i n e s s O b j e c t s \ S u i t e X I 4 . 0 \ C r y s t a l R e p o r t s ]
    " C o m m o n F i l e s " = " C : \ \ P r o g r a m F i l e s \ \ S A P B u s i n e s s O b j e c t s \ \ C r y s t a l R e p o r t s f o r . N E T F r a m e w o r k 4 . 0 \ \ C o m m o n \ \ "
    And then:
    1. Copy the crlogger.dll from the CR win32_x86 directory to a folder which its path length is short than 130 characters.
    2. Add the following registry key to registry:
    "HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Crystal Reports]
    3. Add a string value u201CCommonFilesu201D under the above added registry key with the value as the pathu2019s fullname which folder we drop the crlogger.dll in step #1 (requires to include the ending backslash character u201C\u201D in the path name).
    For example, copy the crlogger.dll form the default CR win32_x86u2019s folder:
    C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\
    into:
    C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\
    Then import the .reg file you created from above.
    Thanks again
    Don

  • Monitoring windows services (and others)

    Hi,
    I am just developing a small, modular monitoring utility, to remotly monitor specific computers on software crashes. Now I would like to code a module, that watches windows services. Are there any classes useful for this? There are a lot of programms listing service status remotely, but I found no useful documentation how they do so, and no (java) source code, that I could adept or at least unterstand. Any tips?
    Thanks,
    Rolf

    I have actually done the same myself. I let a windows java-application run on a remote computer, and connected to it with Sockets. The remote application could then query the service states of the local computer.
    I used PSTools http://www.sysinternals.com/Utilities/PsTools.html (free) for this purpose. The code is ugly but worked. You need to use Runtime.exec launching psservice and then parse the output with Process.getInputStream. Since you are bound to windows-NT platform (which services are), this should not be any problem.
    Example:
    Pattern pattern = Pattern.compile("\\d");
    Process proc = Runtime.getRuntime().exec(new String[] {
                   "c:\\pstools\\psservice.exe", "query", "A service name"
             BufferedReader lReader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
             String lLine;
             while ((lLine = lReader.readLine()) != null) {
                if (lLine.indexOf("STATE") >= 0) {
                   Matcher lM = pattern.matcher(lLine);
                   if (lM.find()) {
                      if (lM.group().equals("4")) {
                         System.out.println("Service is running");
                      } else {
                         System.out.println("Some other service state");
                   return;
             }

  • Making Server and Dispatcher as windows services

    Hi,
    How do I make server and dispatch as a part of windows services. So that they can get start when operating system starts instead of going to the folder and clicking on go.bat. Any documentation?
    Thanks in advance.
    Maya.

    Hi Maya,
    here is how to do it:
    1. Start the Config-Tool (DRIVE:\usr\sap\<J2EE_SID>\j2ee\j2ee_<INSTANCE_NR>\configtool\configtool.bat)
    2. Go to: cluster\dispatcher -> NT Service (Tab)
         choose: Enabled NT Service
    3. Go to: cluster\server -> NT Service (Tab)
         choose: Enabled NT Service
    3. Go to: cluster\state -> NT Service (Tab)
         choose: Enabled NT Service
    4. Go to: cluster\dispatcher -> services -> r3startup
         elements = 0
         -> Add
    5. Go to: File -> Aply
    6. In a Windows CommandShell (CMD) type:  DRIVE:\usr\sap\<J2EE_SID>\j2ee\j2ee_<INSTANCE_NR>\configtool\service -install
    7. Now you can start State Controler, Dispatcher, Server & from the windows services (in this sequence).
    You can also configure the services to start automatic (at windows startup) or not.
    Hope this helps,
    Robert
    PS: You can also consider installing the startup framework with the Enterprise Portal 6.0 SP2 on J2EE 6.20. It's also installed as a windows service and additionaly takes care of restarting processes, which have died/crashed as well as makes possible to unify the clustermanagement (under different operational systems).

  • Classic JVM hangs when running Tomcat as Windows Service

    Hi!
    I am running a Tomcat 3.2.4 application, written with Java 1.3.1_01.
    To run it as a Windows Service (W2000), I am using a slightly altered version of JavaService, which works fine so far: I can use both the "hotspot" and the "server" JVM's (by selecting the jvm.dll from the respective subfolder of the JDK/jre/bin folder).
    However, when I try to run the same application with the "classic" JVM, the service starts, inside of it Tomcat starts, the first output appears (to the stdout logfile) and after some time Tomcat simply hangs - it doesn't respond to anything anymore, 0% CPU, no output to logfiles anymore, doesn't even respond to normal Tomcat shutdown (e.g. when stopping the service, Windows waits the standard timeout then just kills it).
    Using the classic JVM in a console (e.g. not through JavaService and the classic/jvm.dll) works fine! No problems!
    Anyone here who can offer any help on this?
    Any hints why Tomcat may behave correctly in 5 out of six possible configurations (hotspot-server/client as service or console or classic as console) but hanging with 1 configuration (classic as service)?
    Also, on my W2000 box where this happens, the moment Tomcat hangs, I hear a Windows warning sound being played (the standard warning gong), like it happens when an info dialog pops up - only there is no dialog or whatever and the same moment Tomcat's CPU usage drops to 0% (although the app is still in startup and should do some more work for a few seconds).
    This also doesn't always happen at the same moment during startup, but each time at a different moment, e.g. I can not pin it down to something that is done during startup, it just happens a short while (sometimes earlier, sometimes later) after startup...
    Of course, I could simply say "forget classic, it's being phased out anyway", only: The SAME thing happens with IBM's Java 1.3 VM too (except for the gong sound, which seems to be Sun-JVM specific ;-)! And I would very much like my app to be able to run on IBM's VM (usually I'm using Sun's VMs everywhere, but we have a few stray W2000 boxes with SP2 where Sun's 1.3.1_0x VMs crash with our application [not hang like described above, but really crash, even when run as a console]) and on those boxes the IBM JVM in a console works fine - now I only have to get it working as a service too (and while researching why it hangs I saw that Sun's classic JVM hangs too, so I figured, I first find out why that happens, with the hope that the fix is applicable to IBM's JVM too...).
    Thanks already,
    Johannes

    re setting classpath when using JavaService
    for Win2k, Tomcat 3.3.1a, JDK1.2
    below is my script for creating/installing JavaService
    (based on Alexandria web site version). However, if i
    try to add .jar files to classpath (ie, CP environment
    variable), the service does not work. It only works
    when this single .jar file is there. How can .jar or
    .zip files be added to classpath for this service?
    I've not been working with Tomcar as a service, so can't help directly, but can offer some comments that might be of use (apologies if they aren't!).
    There are Tomcat scripts for V3.1, V3.2 and V4 with the JavaService code from Alexandria SC. Looks like you need one for V3.3 as well?
    In these others, there are fairly long lists of jar files in the classpath, so I would expect it to work correctly for the version you are using (unless there is a problem with the way that classloaders are involved, which is something that is known to get in the way for some app server-based programs).
    I would expect the classpath to work if changed from what you have listed to something like the following:
    set CP=%TOMCAT_HOME%\lib\tomcat.jar;%TOMCAT_HOME%\lib\jaxp.jar;%TOMCAT_HOME$\lib\other_library.jar
    Is that what you have tried to do, and found problems?
    Does this version of Tomcat bundle all of its resources into a single jar file (tomcat.jar), or is that a file you have created yourself?
    Is the problem found when loading and starting Tomcat itself, or from within your server-based application?
    Does it fail to load a 'standard' Tomcat library archive, or a jar file containing your own program code?
    set CP=%TOMCAT_HOME%\lib\tomcat.jar
    echo %CP%
    JavaService.exe -install "Jakarta-Tomcat"
    %java_home%\jre\bin\classic\jvm.dll
    -Djava.class.path=%CP% -Dtomcat.home=%TOMCAT_HOME%
    -Djava.security.policy=%TOMCAT_HOME%/conf/tomcat.policy
    -Xms128m -Xmx128m -start
    org.apache.tomcat.startup.Main -params start -stop
    org.apache.tomcat.startup.Main -params stop -out
    %TOMCAT_HOME%\logs\stdout.log -err
    %TOMCAT_HOME%\logs\stderr.log
    Regards,
    John Rutter

Maybe you are looking for

  • Verizon Online Backup and Sharing using FTP

    Can I access my Verizon Online Backup and Sharing 250MB with an FTP client instead of installing the backup software?

  • Gmail error "The user name or password for Gmail is incorrect"

    Starting the other day I am getting the above error when I try to access my gmail account on my iphone4 and I get the same error on my iMac. This is the 2nd or maybe 3 time this has happened. The last was exactly month ago. Also keep in mind I can ac

  • Enterprise service ECC_INDIVIDUALMATERIALIDQR

    hi i am new to SOA. I want to test the above standard service. i went to SOAMANAGER tcode and in webservice administration i have found out this service. i have clicked on "Apply selection" and then in "cinfigurations" tab there are no service and en

  • Appcrash - Photoshop when using photomerge

    Hi all. Photoshop (CS5) crashes when I select "File / Automate / Photomerge". It crashes before any option to select anything so it's not a memory issue. As I don't use this option often I cannot say when the error first occured. I am running Windows

  • ICloud restore help!

    I recently had to remove Pages from my iPad and add it back on. Before I deleted the app, I saved all my work to my iCloud on my iPad. It shows in iCloud I have the data there. How do I restore it to my Pages App so I can see the documents again? Eve