From time to time, organizations require to build a new BY/JDA WMS Instance on either Windows Server or Linux — depending upon their requirements. Today I will show the simplest example of cloning a BY WMS instance on Windows Server 2016/2019 and editing MOCA Server’s service using the registry editor.
So below is a screenshot of what my current instance looks like and I will do a simple replication.
So now let’s go ahead and copy/paste this instance into a new folder, let’s call it SB20. However, if you use normal windows copy/paste functionality, you might get the Destination Path Too Long error — Click on the hyperlink on how to fix this error.
So, now that we have copied our BY/JDA WMS instance to a new location, we will have to make the following configuration changes:
- Add an entry on the rptab file. You can read in detail about rptab setup on the link: RedPrairie/JDA WMS — rptab file
- Correct registry and env.bat file for instance-specific values
- Backup/Restore database with a new name or schema for Oracle.
Once all of this is done, you can run env.bat followed by msql -S command to validate if you’re able to connect the new instance to the database. Click here to read on Msql utility for more details.
So the next step is to install the MOCA Service to be able to start/stop the instance via Windows Service. Run the env.bat as Administrator and then execute the following command.
servicemgr -e %MOCA_ENVNAME% install
Now you may ask, why does this service look different than the standard install? Well, to be honest, this is the first time I am seeing this on BY WMS 2020. But nevertheless, we can manually fix this. I am presenting you with this problem specifically so you’re aware of it and know how to correct it.
The service manager (servicemgr.exe) is a utility provided in the instance’s MOCA\bin directory to allow an easy way to install the service, but it is not the only way.
So we can run the sc create command to see what parameters are needed to pass in order to create the service manually.
So the parameters that we need are Service Name binPath and DisplayName
sc create MOCA.instancename binpath=" E:\JDA\instancename\MOCA\bin\prunsrv.exe //RS//moca.instancename" DisplayName= “MOCA Server (instancename)”
So let’s create our MOCA Service now.
As you can see that our service looks like how we wanted it to be. However, the description is still missing. To add a description for a service, you can run the following command.
sc description servicename "description for service"
Now let’s attempt to start our service…
If you look at the Event Viewer logs, you will see the following error:
Incorrect function
To fix this issue, we will have to get our hands dirty and fix the windows registry parameters that are used to start/stop the MOCA Services.
The first step would be to take a complete backup, in case of an accident and want to rollback to this state. Open Registry Editior by using regedit from Start > Run. Then select Computer and click on Export.
Note, this step may take a couple of minutes to complete. Now head over to the source instance’s registry and export it. We will edit this export and import it with the target instance’s name.
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\moca.sourceinstance
Once exported, open it in notepad++ or any other text editor and replace the source instance name with the target instance. However, there are some values exported as hexadecimal and we will have to correct those after importing it.
Once all registry entries have been corrected. run env.bat and then run the msql -S utility to validate if you are able to query on the new database. However, this method is dangerous and should be done if you are experienced in modifying the windows registry.
Another way of editing a window’s service is by using the sc config command:
sc config moca.instancename DisplayName="MOCA Server (instancename)"
This goes and changes the registry configuration under:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\moca.instancename
Hope this helps! Please don’t hesitate to comment below if you have any questions.