Diagnosing Problems Running Accpac Part 1
This blog post is going to go into quite a bit of detail on what happens when you double-click on the “Sage Accpac ERP” desktop icon. Many of you have had conversations with our technical support department and many have wondered why they ask you to do the things they ask. Why do they ask you to run RVSpy/DBSpy? Does it tell them anything useful if it comes up blank? What do all those options in Accpac Spy mean? A lot of times what they are trying to do is diagnose where in the startup process things have gone wrong and what area do they need to concentrate on. A lot of times the net starts wide and then gets drawn in around the problem.
So to start with you double click on the “Sage Accpac ERP” icon. This then runs the Accpac.exe program in the runtime directory of where ever you installed Accpac. When you double click on the icon, Windows will load that EXE and it will find and load all the DLL’s it is statically linked to. Some of these DLLs are part of Windows itself, some of these are part of the Microsoft C/C++ runtime and MFC library, and many are DLLs installed in the Accpac runtime directory. All these DLLs might be statically linked to other DLLs. In total 39 DLLs are usually loaded with Accpac.exe as a result of double clicking on the icon. When we install Accpac we try to give Windows the best chance of finding all these DLLs that we can. Windows looks for DLLs in the following places:
- The same directory as the EXE (ie accpac\runtime).
- The current working directory (the “start in” field in the icon properties, usually accpac\runtime).
- The Windows System Directory (windows\system32).
- The Windows Directory (windows).
- The directories listed in the PATH environment variable (should include accpac\runtime).
Some things that can go wrong with this process include:
- Not having execute and/or read security access to a directory where one of these is installed.
- Having a corrupted PATH environment variable. If something didn’t handle a path with spaces properly or didn’t separate things properly with semi-colons, it can cause loading problems for all sorts of things.
- On terminal server a user has a local windows directory as well as the main windows directory. Sometime things can be installed properly for one user but not another because things installed into their local windows directory rather than the global one. This was a problem with the older Crystal 8.5 runtime, but newer Crystal runtimes handle this ok. (Crystal actually isn’t required at this point).
- Having multiple versions of System Manager installed at once in different locations. This can happen if you use programs like “UniLauncher” to run multiple versions of Accpac. This often causes multiple accpac\runtime directories to be in the PATH, or the Accpac icon points at once place and then a different accpac\runtime is used to load the DLLs. Running the wrong version of these DLLs will cause all sorts of problems. If you need to use multiple versions of Accpac System Manager, it is far safer and less hassle to use virtual machines like Microsoft’s VirtualPC to run the various configurations each in their own VM. This also allows you to run several at once and avoid them getting mixed up.
- Viruses can cause all sorts of strange problems.
- Disk drives that are starting to fail and causing some files to fail to be read.
- Note also that Accpac.exe and all these DLLs are 32-Bit. They will run fine under 64-Bit Windows. But if you are a developer and want to use these DLLs yourself then you need to compile for 32-bit in order to load them. 32-Bit DLLs can only be loaded by a 32-bit process, not a 64-bit process. 64-Bit IIS will spawn 32-Bit processes for this reason if configured to do so. .Net programs and Java programs can be compiled for either.
Besides outright not working, it could be that it takes quite a long time to reach the sign-on dialog after clicking the icon. These are usually related to networking issues. Most customers install the Accpac programs on a shared file server, so they don’t need to be installed on every workstation and so they can apply product Updates to one place. Some things to note:
- Use UNC paths (\\myserver\myvolume\accpac) rather than mapped network drives. There are many Microsoft knowledgebase articles of various bugs in mapped drives. They may work fine for you or you might run into one of these depending on your environment. Search the Microsoft knowledge base to see if you fall into one of these scenarios.
- Bad DNS entries. Sometime if your network isn’t configured properly network requests can takes quite a long time. Try “ping myserver” to ensure this is fast (<1ms). If it isn’t then you will take a long time to load due to the number of DLLs that must be loaded.
- Running too many virus checkers. We’ve seen people running 5 different virus scanners at once. This sort of thing can really slow things down. Also if you know your server is running a virus scanner then have the workstation exclude network shares/drives since this is just double work.
Rather than figure these problems out, many people find a Terminal Server configuration more convenient since everything is installed locally on the terminal server, so you don’t have the network problems. You also maintain the advantage of having Accpac only installed in one place so you don’t need to apply Product Updates all over the place. Other people, if they don’t want to use Terminal Server, will install the Accpac programs locally on each workstation. This is more work, but again avoids some network speed problems, you may still have some problems when you access the shared data directory or the database server when you finally sign-on.
Accpac.EXE is a Windows executable program that is written in C++ using the Microsoft Foundation Classes (MFC) library. Once Accpac.exe is loaded and running then our code is finally executing and we will use the MFC library to create the desktop window layout. MFC stores its configuration stuff in the registry. These are things like the sizes of the various panels the last time you exited Accpac. These are stored under:
HKEY_CURRENT_USER\Software\ACCPAC INTERNATIONAL, INC.\ACCPAC
There are 5 keys that all start with the word “FrameState”. If these registry entries become corrupted for some reason, then Accpac will not start. These registry entries can be safely deleted, you will just set the frame sizes back their defaults and they will be re-created the next time you run Accpac.
Accpac splits its files into two categories the “Programs” directory and the “Shared Data” directory. The programs are all the executable programs and DLLs that make up the Accpac program. The “Shared Data” directory are various non-database files that store useful information relevant to Accpac. The “Shared Data” directory must be shared by all users on the system, they must all look at the same directory or there could be problems. The Programs can either be common, or people can look at their own copy. You must be able to read and execute the programs directory, and you must have full control over the shared data directory. These directories are stored in the registry under:
HKEY_LOCAL_MACHINE\Software\ACCPAC International, Inc.\ACCPAC\Configuration
These are stored in the Programs and SharedData keys.
Accpac will check if you are licensed to run this version of System Manager. It will access accpacshareddata\sm56a0.lic to validate that you are properly licensed. If you have an expired 30 day (or other period) license, are missing this file, etc. Then you won’t be allowed to run Accpac. The desktop will also do a quick scan of your other license files to see if there are any inconsistencies or suspicious entries. If so then you will be re-directed to the Sage Anti-Piracy web page.
Accpac will also open accpacshareddata\site\semaphor.bin to see what others are doing in Accpac. This file can be deleted if causing problems (when everyone is out of the system) and will be re-created the next time you run Accpac. Again security access rights are the most common cause of problems here since Accpac.exe needs full control of this file. Accpac controls access to different parts of the program by placing byte locks in this file. Usually these are cleaned up when Accpac exits, or are cleaned up by Windows if Accpac terminates abnormally, or if a workstation disconnects unexpectedly from the server. However sometime Windows gets confused and these locks need to be cleared by re-booting the file server where this file resides. If you have to do this frequently then you have some other problem going on and need to investigate with FileMon (discussed below).
Accpac will access accpacshareddata\site\orgs.ism to load the list of companies you can logon to into the sign-on dialog. Orgs.ism is a simple isam file. It needs to be stored outside of the database since it contains the information required to sign-on to the database. If this file is corrupted then you may not be able to get to the sign-on dialog. Run scanisam to see if there are problems. It might also be able to fix them. Otherwise get a fresh copy from another install and re-populate it (admittedly a pain).
The best way to diagnose problems that happen before the sign-on screen is reached is to use the “FileMon” program from SystemInternals (now owned by Microsoft). Their web site is: http://technet.microsoft.com/en-ca/sysinternals/default.aspx. Its worth having a look through their utilities, they are really useful. Regmon is another very useful program to monitor for registry errors. Often these programs will show quite useful information, but they will fill up fast. Often worth stopping any windows services not associated with Accpac when you run these to reduce the noise.
This blog post is getting quite long, and we’ve only just got to the sign-on dialog. If I’ve forgotten something, I’ll update this post. Next week we’ll look at what happens when you click OK on the sign-on dialog.