6 Replies Latest reply on Aug 25, 2011 11:09 AM by Udo

    I lose the connection when closing the CMD

    fatehcis-JavaNet
      Hi guys,

      I have configured a standalone listener as following:

      C:\Program Files (x86)\Java\jre6\bin> java -Dapex.home=D:\list -Dapex.images=C:\images -jar D:\apex.war
      Afterward,
      If I close the CMD, I will lose the connection, and I have to reconfigure it again.
      If I open APEX locally , I mean by using the shortcut "Get Started With Oracle Database 11g Express Edition" , Then I will lose the connection that uses the default port of the listener, that is 8080.

      After I configured the listener I got this message on the CMD

      -- listing properties --
      PropertyCheckInterval=60
      ValidateConnection=true
      MinLimit=1
      MaxLimit=10
      InitialLimit=3
      AbandonedConnectionTimeout=900
      MaxStatementsLimit=10
      InactivityTimeout=1800
      MaxConnectionReuseCount=1000
      APEX Listener version : 1.1.2.131.15.23
      APEX Listener server info: Grizzly/1.9.18-o
      May 21, 2011 5:14:41 PM com.sun.grizzly.Controller logVersion
      INFO: Starting Grizzly Framework 1.9.18-o - Sat May 21 17:14:41 GST 2011
      INFO: http://localhost:8080/apex started.
      Using JDBC driver: Oracle JDBC driver version: 11.2.0.2.0


      Regards,
        • 1. Re: I lose the connection when closing the CMD
          Udo
          Hi,

          I'm not sure I got your question right, but I'll try to find some solution anyway.
          If I close the CMD, I will lose the connection, and I have to reconfigure it again.
          That's what happens when a shell is terminated - all associated processes will stop as well. However, if you have a apex-config.xml in your apex.home you shouldn't need to configure your APEX Listener each time your start it, but it would reuse an existing configuration.
          If I open APEX locally , I mean by using the shortcut "Get Started With Oracle Database 11g Express Edition" , Then I will lose the connection that uses the default port of the listener, that is 8080.
          Now, if you have XE running on the same (local) machine as you have your APEX Listener running in standalone mode, you probably have a port conflict: By default, both APEX Listener in standalone mode and the Embedded PL/SQL Gateway (EPG) use port 8080. The EPG is activated as web server for APEX in XE after a fresh installation, the APEX Listener would be an alternative in that case. You can either stop the EPG, or reconfigure any of the two web servers to use a different port, if you want to run them parallel.
          To change the port used by the APEX Listener in standalone mode, you simply add another parameter to the startup: -Dapex.port=8888 and you're done.
          To change the port used by the EPG, connect as sys and run the following
          EXEC DBMS_XDB.SETHTTPPORT(8888);
          COMMIT;
          If you want to disable the EPG, simply set the port to *0* .
          After I configured the listener I got this message on the CMD
          That's what it should look like.
          No, since your topic is "lose the connection when closing the CMD", I assume you search for an alternative. You could run the APEX Listener as a Windows service, even in standalone mode. To do this, you create a batch file, e.g.
          %JAVA_HOME%\java -Dapex.home=D:\oracle\APEX_Listener\_home -Dapex.images=D:\oracle\apex_4_0_2\images -Dapex.port=8888 -jar D:\oracle\APEX_Listener\apex_listener.1.1.2.131.15.23\apex.war >>D:\oracle\APEX_Listener\apex_listener.1.1.2.131.15.23\my_apex_listener.log 2>&1
          Note that you have to set JAVA_HOME as system property or replace the call with the absolute path to your JDK or make sure the JDK is in your PATH variable.
          Of course, you can and should change the other directories as well to fit to your system.
          Next, create a Windows service, e.g. using [url https://iain.cx/src/nssm/]NSSM (free) or [url http://support.microsoft.com/kb/137890]SRVANY (MS, non-free), that starts your batch as a windows service.
          The command for creating that service using NSSM could look as follows
          nssm install APEX_Listener D:\oracle\APEX_Listener\apex_listener.1.1.2.131.15.23\startup.cmd
          You can edit the service properties afterwards, e.g. change the start mode from "Automatic" to "On Demand".

          I hope this answers your question. If not, please point me into the right direction.

          Thanks,

          Udo
          • 2. Re: I lose the connection when closing the CMD
            865294
            Thanks Udo for the advice on setting up the NSSM windows service ( i was using srvany before but did not get the detailed logging - i probably didnt have it configured correctly),

            I now have a standalone listener running with NSSM (on windows 7) with the following entry in my startup.cmd file:
            "%JAVA_HOME%\bin\java.exe" -Dapex.home=E:\tmp\apex -Dapex.images=E:\apex_4.0.2_en\apex\images -Dapex.port=8080 -Dapex.erase -jar E:\apex_listener.1.1.2.131.15.23\apex.war >>E:\apex_listener.1.1.2.131.15.23\my_apex_listener.log 2>&1

            A word of warning though - after struggling a bit with errors in the logs I found that i needed to run the java command manually for the first time (in a command prompt as administrator) - just to setup the passwords for the adminlistener and managerlistener accounts. But once setup the service now works really well, Thanks!
            1 person found this helpful
            • 3. Re: I lose the connection when closing the CMD
              Udo
              But once setup the service now works really well, Thanks!
              I'm glad to hear that.
              A word of warning though - after struggling a bit with errors in the logs I found that i needed to run the java command manually for the first time (in a command prompt as administrator) - just to setup the passwords for the adminlistener and managerlistener accounts.
              Indeed. In the post above I recommended having the apex-config.xml in the apex.home already. It seems I didn't point that out with enough emphasis. Thanks for highlighting that demand.

              -Udo

              P.S.: Could you please mark that question as answered using the account of the original post, and mark helpful and/or correct answers in order to make it easier for others searching the forum to spot relevant posts easy.
              • 4. Re: I lose the connection when closing the CMD
                fatehcis-JavaNet
                Dear Audo,

                I appreciate your help, and I am sorry for being late to mark this question as "Answered".

                Best Regards,
                Fateh
                • 5. Re: I lose the connection when closing the CMD
                  479332
                  Can it really be true that the developers at Oracle thought that the standalone CMD window was an acceptable solution, so that's why we have to use a third-party tool to install the Apex listener as a service? Does UAT mean anything at Oracle?
                  • 6. Re: I lose the connection when closing the CMD
                    Udo
                    This thread has long been marked as answered as the reported problem was solved.
                    If you want a discussion on the requirement to re-invent missing OS features, please start your own thread, but don't cannibalize existing ones. There are users who just search for a solution for a given problem, and I think your post won't help them.

                    Thanks,

                    Udo