Oracle provides a good alternative for using the EPG in single-developer projects. It is called the Oracle APEX Listener.

it is intended to run as some kind of plug-in in:

  • Oracle WebLogic Server.
  • Oracle GlassFish Server.
  • Oracle Containers for J2EE (OC4J).

But it also runs in a stand alone mode.

This time I’d like to discuss the latter, stand-alone mode.

Advantages

Using the listener in stand-alone mode, for me, has several advantages.

  • super fast to set up
  • easy to automate
  • possibility to start more instances (ie for each APEX instance)
  • no WebDav/FTP access required to the /i/ folder
    (this also has a drawback when enrolling your app)

Disadvantages

The main drawback is that it won’t install as a service on Windows.

Setup

Using the installation guide you’ll be up and running within minutes. Oracle did a good job in explaining this. I will not elaborate further on this.

In essence you need to start the Listener as follows:

java.exe -Dapex.home={PATH_A} -Dapex.images={PATH_B} -Dapex.port={PORTNUMBER} -jar {PATH_C}

The Listener now will try to find settings in the {PATH_A}. If it cannot find them, it will first ask for a username and password for the adminlistener and managerlistener users, after which it will start the browser with a configuration page.

Apex listener configuration page
Apex listener configuration page

Here you give the Listener the information it needs to connect to the database. It’s a kind of DAD… You only have to fill out the first tab. The rest you can leave as default. When you apply the Listener will save this information into the {PATH_A} location.

{PATH_B} points to the images directory, in my case that is d:apex4apeximages so I can edit and save CSS, images, HTML etc as I please.

{PORTNUMBER} is the portnumber the listener is listening to. In my case that is 81, but you can put it on any port you like (even 80!).

{PATH_C} points to the apex.war java program.

Once the Listener has saved the connect-information into the {PATH_A} location, we can easily switch the listener to another port without any re-configuration. Just use the same command and only replace the {PORTNUMBER} variable with the desired port-number. My batch-file will handle this.

Putting it all together

Now I’ve explained how to start the listener the next step is to do some automation.

I created a batch file that you can use to automate starting the Listener.

::@echo off

pushd D:Oracleapxlistener
setlocal

set tmp=tmp.%1%
set java=c:Program FilesJavajdk1.6.0_24binjava.exe
set apx_user = RMARTENS
set apx_workspace = APEXDEMO
set apx_listener = D:Oracleapxlistenerapex.war
set browser = "c:Program Files (x86)Mozilla Firefoxfirefox.exe"

if not exist %tmp% mkdir %tmp%

start "ApexListener %2% %1%" /MIN "%java%" "-Dapex.home=%tmp%" -Dapex.images=D:apex4apeximages -Dapex.port=%2% -jar %apx_listener%

pause

echo Listener started

start "Oracle Apex" %browser% "http://localhost:%2%/apex/f?p=4550:1:::::F4550_P1_COMPANY,F4550_P1_USERNAME:%apx_workspace%,%apx_user%"

:einde
endlocal
popd
exit

If you save this as a batch file and edit lines 7 to 11 to reflect your settings, you’ll be able to start your listener as:

apxlistener.bat apexdemo 81

Which starts the listener using the settings in the apexdemo folder on port 81.

The batch can be further extended to have different /i/ folders for each environment, but for me that was not needed.

— Good Luck ! —

6 thoughts on “Using APEX Listener as Stand-alone HTTP server on Windows

  1. Helpful post.
    I’ve been looking for information about the licensing for the listener. Can we use it on a seperate server then the database without the need to buy more licenses?
    Thanks in advance for any info.

    Reply
  2. As far as I know yes, the listener is for free.

    The Oracle HTTP server only is free when it is running on the same server as the database is.

    Regards,
    Richard

    Reply
  3. The Oracle listener runs nicely as a Windows server with jwinsvc:
    First run and configure the listener in a command window. Then shut it down and start it jwinsvc using the same parameters. Example

    jwinsvc “Oracle APEX Listener 1″ /install /start java -Dapex.home=”%~dp0service1″ -Dapex.port=8080 -Dapex.images=”%~dp0images” -jar apex.war

    Reply
  4. Groeten uit Chicago
    Excuse my barging onto your blog. I’ve tried posting queries on Oracle Forums but dont get much response
    Admittedly I am an Apex Virgin. I have 25 years experience as a mainframe developer using exciting cutting edge technologies like Assembler and COBOL ( not really cutting edge)
    But now I have a client who wants me to move an application from mainframe to oracle

    I chose Oracle 11r2g Apex 4.2 and Apex Listener 1.1.14
    Everything goes fine with the installation. I can follow the documentation despite my mental impairment of having been raised as a mainframe person.

    But then I get to configuring the Apex Listener

    I do the java -jar C:apex_listenerapex.war. Enter all the information it asks for and get to the http://localhost:8080/apex/listenerConfigure screen.

    And cant go further

    I want to create a TNS connection. I have a TNSNAMES.Ora file. It works fine when I connect to the database with SQLDeveloper

    When I try to create a TNS connection I always get a message saying invalid username/password

    When I try to create a basic connection, sometimes I get the same message. Sometimes I get an IO error

    I’ve actually deinstalled and deleted everything twice to make sure I had the correct passwords

    Questions:

    -What Username is the Listener Configuration URL looking for:
    It defaults to APEX_PUBLIC_USER but doesn’t accept that password. But there is also the Apex Listener Administrator created during installation, ADMIN, APEX_REST_PUBLIC_USER etc
    It doesn’t like any of these

    -If I create a basic connection; again, which username?
    – The basic connection defaults to port 1521, but my httpport is 8080 so I assume I should use that
    – What is service name? can I just make up a unique service name?
    -if a create a basic connection, how do I use the TNSNAMES.ora file?

    I’m also not understanding ‘it won’t install as a service on Windows’, I dont see any reference to
    this in Oracle docs and seems that people are running it with windows

    Hartelijk dank

    Steve

    Reply

Leave a Reply