Sunday, August 5, 2012

Apex Listener - Connecting to multiple databases

Warning: This will become obsolete when Kris Rice releases Apex Listener 2.0. Already Apex Listener EA1 is out.

I have already blogged about Installing Apex Listener on Tomcat and Managing Apex Listener.

If you have already installed Apex Listener 1.1 or temporarily want to connect to multiple databases then you can follow the steps.

1. Decide on the deployment name. Default one is /apex/. Select another one like /testdb/. Once you decide on the deployment name, goto <Tomcat Home>/webapps folder on your PC/Linux VM etc. and copy apex.war to testdb.war.

2. Configure the new Database Connection by accessing http://localhost:8080/testdb/listenerConfigure
Tomcat will automatically extract testdb.war content and will create testdb folder inside webapps.
Then it will give you a surprise and will say
"The APEX Listener is already configured. Please login as Administrator to access APEX Listener Administration." Let's fix it.

3. Open up <Tomcat Home>/webapps/testdb/WEB-INF/web.xml and configure "config.dir" as follows.

<param-value><Your Tomcat Home>/webapps/testdb</param-value>
Use the full path of your Tomcat Home and never tried relative path. testdb is your deployment folder.

4. Now restart your Tomcat and access the following URL to configure to your new database instance.
http://localhost:8080/testdb/listenerConfigure. Once deployed you can access your database applications using http://localhost:8080/testdb/f?p=<app>:<page>

PS: After deploying 4 or 5 apex war files I started to get "OutOfMemory" exception in TomCat. I have put in the following code in Tomcat (Present under <tomcat Home>/bin folder) to address the issue temporarily. Please post a comment if you have better fix.

# To avoid Out of Memory error
export JVM_ARGS="-Xmx1024m -XX:MaxPermSize=256m";
export CATALINA_OPTS="-Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m";

No comments:

Post a Comment