Some insight on how to refresh files with Apex, Apex listener and Weblogic.
Recently I had to setup a new Apex 4.2 configuration using Weblogic 10.3.5 (11g) using Apex Listener 2.0.1 and Oracle 11g database. My concern was about how my style files end up on the webserver directly.
There are some articles on how to do this, but I would like to share my encounters as a developer since not all was clear.
Besides the apex listener to deploy, in the past it was common to create a “java -jar prj_images.war static \images” bundle for your project and deploy it in Weblogic. This would contain all Apex images/stuff too, since otherwise you would get the ‘blank page’ Apex problem when developing.
For me, now with listener2 prj_images.war just contains:
web-inf\sun-web.xml
web-inf\web.xml
web-inf\weblogic.xml
Which mean only some references to your favourite location:
sun-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app>
<!-- This element specifies the context path the static resources are served from -->
<context-root>/prj_images</context-root>
<!-- This element specifies the location on disk where the static resources are located -->
<property name="alternatedocroot_1" value="from=/* dir=/volumes/ora01/oracle/.../apex/images"/>
</sun-web-app>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<!-- This Web-App leverages the alternate doc-root functionality in WebLogic and GlassFish to serve static content
For WebLogic refer to the weblogic.xml file in this folder
For GlassFish refer to the sun-web.xml file in this folder
-->
</web-app>
weblogic.xml:
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<!-- This element specifies the context path the static resources are served from -->
<context-root>/prj_images</context-root>
<virtual-directory-mapping>
<!-- This element specifies the location on disk where the static resources are located -->
<local-path>/volumes/ora01/oracle/.../apex/images</local-path>
<url-pattern>/*</url-pattern>
</virtual-directory-mapping>
</weblogic-web-app>
Within this “/volumes/ora01/oracle/.../apex/images
” directory you might find your other default Apex stuff and a themes directory with all those themes from the wizard. Typically these directories can be ommited in an production environment (no Apex things, just runtime workspace), in development you can put your images, js and css stuff in a self created theme directory. In this example below the default themes directory a ‘mytheme’ directory is added.
In Apex make sure you have set /prj_images/:
And in themes use:
This should be working fine. Then I’ve put some images and new .css files in this directory. Unfortunatelly nothing happens.
Edit /volumes/ora01/oracle/…/apex/images/imagelist.xml and add the <directory> entries and <file> entries with our newly added files.
When using the Embedded PL/SQL Gateway (EPG) I guess this was enough, when using Weblogic it is best to redeploy the .war file which was not altered anyway. That .war file containing the references. In Weblogic, “Lock & edit”, select the .war file and press Update, Next and Finish. Don’t forget to activate the changes and then “Release Configuration”: