Running Standalone APEX Listener as Windows Service

Service
When working with APEX you certainly want to use the APEX Listener. It’s a great piece of software and Oracle is committed to extend its functionality (Oracle recently release the beta version of the new APEX Listener 2.0).
When installing the APEX Listener, you basically have two choices:
  • run APEX Listener “Standalone”
  • deploy the Listeners WAR file to one of the supported webservers
The problem (at least, my problem): when using the APEX Listener on my laptop/desktop with my local APEX instance, I do not want to set up a whole webserver, just to be able to develop APEX applications. So I,’m choosing the lightweight option: Standalone! But the annoying thing about the standalone installation is, that I have to start the APEX Listener from the command line each time I want it to be available. It just would be so much easier to just have it as a Windows service, stating during system boot.
Seems that an APEX developer from Poland, Andrzej Nowakowski, solved this problem for us and blogged about it, but the reason I probably never read his post is that he wrote the post in Polish. I followed the (Google Chrome) translated instructions, and after a little (just a little) struggle, I have my APEX Listener running as a Windows service.
So here is my post, mostly translating Andrzej’s instructions, in English.
Usually you would install/start the APEX Listener standalone mode by issuing the following statement, as documented in Oracle’s Installation Guide:
java -jar apex.war
This will create my Listener’s configuration files in the Windows path C:\Users\christian\AppData\Local\Temp\apex by default, using ${java.io.tmpdir}/<Mount-Point>/apex-config.xml. To avoid using the environment variables, which could be different when starting APEX Listener during system startup as a service, I’m going to let the Listener create its configuration files in a less user-dependent path using the listeners command line parameter –Dapex.home:
java -Dapex.home=C:\oracle\apex_listener.1.1.4.195.00.12\listener_conf -jar apex.war
C:\oracle\apex_listener.1.1.4.195.00.12 is the folder I installed/extracted the Listener software into. For the rest of the installation process, just follow the instructions in the installation guide. Now you should have a command line window open running the APEX Listener. Closing this window will shut down the listener.
To get rid of starting the Listener manually, we need to find a way to start the command as service. A little freeware program does the trick: NSSM - the Non-Sucking Service Manager. Starting NSSM, you just need to enter the <path>/command, its command line options and a name for the windows service. Make sure nssm.exe is installed somewhere where Windows can find it through the $PATH environment variable.
For my APEX Listener, I create a .bat file that I then call as service startup script, startlistener.bat, and put it into my Listener’s installation folder.
c:
cd \
cd C:\oracle\apex_listener.1.1.4.195.00.12
java -Dapex.home=C:\oracle\apex_listener.1.1.4.195.00.12\listener_conf -jar apex.war

Now all I have to do is starting a command window (in Administrator mode) and call
C:> nssm install
I enter my .bat file and give my service a name in the dialog window popping up:
nssm
Done:
taskmanager

themes4apex

Comments

Popular posts from this blog

Remember Me - APEX Autologin

Tabular Forms on Complex Views - using INSTEAD OF Triggers

Book Review: Oracle APEX 4.0 Cookbook