APEX with JBOSS 7:

 


 


Well, I spent 3 days to get this going. It is not pretty but it works and I am sharing all the mess I had to go through to make it work.

 


1- Download JDK 7 from here - http://www.oracle.com/technetwork/java/javase/downloads/index.html

 


2- Download JBOSS 7 from here http://www.jboss.org/jbossas/downloads/

I downloaded 7.0.2 final

 


3- unzip JDK 7 and asign th eunzipped directorya s JAVA_HOME and add to the path. For me:

 


export JAVA_HOME=/home/oracle/jdk1.7.0_01

export PATH=$JAVA_HOME/bin:$PATH

 


4- unzip the jboss and assign this as JBOSS_HOME. for me it is:

 


JBOSS_HOME=/home/oracle/jboss702

 


(Please do not start the jboss yet)

 


5- Please copy the images for APEX as defined in step 4 here  - http://apexdplsepg.blogspot.com/2011/12/install-upgrade.html

 


 


6- Untar the images from step5 to $JBOSS_HOME/standalone/deployments. for me it is:

 


/home/oracle/jboss702/standalone/deployments

 


7- Download the APEX listener and extract the apex.war from here -

 


http://www.oracle.com/technetwork/developer-tools/apex-listener/downloads/index.html

 


8- Please do this as indicated below - Very important steps below.

 


cd $JBOSS_HOME/standalone/deployments

 


mkdir apex.war

 


cd apex.war

 


jar -xvf /homne/oracle/dwnld/apex/apex.war

 


(Please note that I downloaded and unzipped the APEX listener at /home/oracle/dwnld/apex location)

 


mkdir /home/oracle/aptmp

 


cd /home/oracle/aptmp

 


jar -xvf $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/lib/apex.jar

 


cd META-INF

 


vi oracle.dbtools.rt.services

 


delete the following line from it:

 


oracle.dbtools.rt.uri.WarURIResolver

 


save and exit

 


now repackage this as:

 


cd ../ to go to /home/oracle/aptmp

 


jar -cvf /home/oracle/apex.jar *

 


(This will create apex.jar in the /home/oracle direvctory)

 


rm -f $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/lib/apex.jar

 


cp apex.jar $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/lib/

 


cd $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF

 


vi adminTemplate.html 

 


Replace all scripts to /i/scripts. This is because for some reason when JBOSS deploys the apex.war there is no directory access inside the apex.war and I did not want to put a lot of time to find out as where this permission is set. I look arounf in the web.xml and others but could not find it. However i.war is accessible for other APEX images so I decided to do this way.

 


Mine looks like:

 


amghost3:Oracle ->> grep scripts adminTemplate.html

 


                <link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/i/scripts/images/oracle.ico" />

                <link rel="stylesheet" type="text/css" href="/i/scripts/css/styles.css" />

                <link rel="stylesheet" type="text/css" href="/i/scripts/css/jquery-ui-1.8.5.custom.css" />

                <script type="text/javascript" src="/i/scripts/js/jquery-1.4.2.min.js"></script>

                <script type="text/javascript" src="/i/scripts/js/jquery-ui-1.8.5.custom.min.js"></script>

        <img src="/i/scripts/images/oracle_logo.gif" width="133" height="18"alt="Oracle" class="banner" />

 


 


cd ../ (One step up to /home/oracle/jboss702/standalone/deployments/apex.war)

 


cp -R scripts ../i.war/

 


 


now cd $JBOSS_HOME/bin

 


edit the jboss-admin.sh and change the last line as:

 


eval \"$JAVA\" $JAVA_OPTS -jar \"$JBOSS_HOME/jboss-modules.jar\" -logmodule "org.jboss.logmanager" -

mp \"$JBOSS_HOME/modules\" org.jboss.as.cli '--connect controller=amghost3.cup.com:9009 "$@"'

 


(Please note that I decided to run the web server on 8008 port and 9009 and 9008 for Admin. console)

 


vi standalone.conf 

 


change the JAVA_OPTS. Mine is:

 


if [ "x$JAVA_OPTS" = "x" ]; then

   JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"

   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true -Dapex.home=/home/oracle/apex -Dapex.images=/home/oracle/jboss702/standalone/deployments/i.war"

 


(Please note that the reason I pu the apex variables here is because when we do the listenerConfigure - it will create the conf file in /tmp/apex - so to make it appropriate I did this)

 


 


now cd to $JBOSS_HOME/standalone/configuration and edit teh standalone.xml file. Please note the following changes. These changes are to have HTTP/1.1 in UTF-8 format and Admin and Manager Roles and users for APEX.

 


 


Just below </extension at the top of the file add following:

 


<system-properties>

        <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>

        <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>

    </system-properties>

 


 


then I changed the Admin console port and locked them to use the username as:

 


<native-interface interface="management" port="9009" security-realm="PropertiesMgmtSecurityRealm"/>

            <http-interface interface="management" port="9008" security-realm="PropertiesMgmtSecurityRealm"/>

 


 


Now look for the security-domain where other is mentioned change it as :

 


<security-domains>

                <security-domain name="other" cache-type="default">

                    <authentication>

                        <login-module code="UsersRoles" flag="required"/>

                    </authentication>

                </security-domain>

                <security-domain name="form-auth" cache-type="default">

                    <authentication>

                        <login-module code="UsersRoles" flag="required">

                            <module-option name="usersProperties" value="users.properties"/>

                            <module-option name="rolesProperties" value="roles.properties"/>

                        </login-module>

                    </authentication>

                </security-domain>

            </security-domains>

 


 


Now at the interfaces change the 127.0.0.1 to the name like:

 


<interfaces>

        <interface name="management">

            <inet-address value="${jboss.bind.address.management:amghost3.cup.com}"/>

        </interface>

        <interface name="public">

            <inet-address value="${jboss.bind.address:amghost3.cup.com}"/>

        </interface>

    </interfaces>

 


 


 


and the right beneath it the web port:

 


    <socket-binding name="http" port="8008"/>

 


 


 


Now create  followin 2 files "users.properties" and "roles.properties" as:

 


 


amghost3:Oracle ->> more users.properties

#Format: username=password

#

adminlsn=jboss7

mnglsn=jboss7

 


 


 


amghost3:Oracle ->> more roles.properties

adminlsn=Admin

adminlsn.Roles=Admin

mnglsn=Manager

mnglsn.Roles=Manager

 


 


 


Now edit the mgmt-users.properties and uncomment the admin as:

 


admin=jboss7

 


 


 


 


 


Now remove the xmpparser from $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/lib as:

 


rm -f $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/lib/xmlparserv2-11.2.0.jar

 


 


Oh Well - Bear with me  - couple more steps ---

 


 


Now start the JBOSS as cd $JBOSS_HOME/bin

 


./standalone.sh

 


 


Now cd $JBOSS_HOME/standalone/deployments

 


touch i.war.dodeploy

 


 


wait until you see "i.war.deployed"

 


Now touch apex.war.dodeploy

 


Now wait until it says apex.war.deployed

 


Now the magic part :

 


http://<host>:8008/apex/listenerConfigure

 

 

and after inputs above you will end up at:

 

 

Now shutdown the JBOSS and do following:

 


amghost3:Oracle ->> cd /home/oracle/apex

amghost3:Oracle ->> ls

apex-config.xml  bdb

 


vi  apex-config.xml

 


and remove following line from the top of the fikle:

 


<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

 


save and exit

 


 


Now copy users.properties and roles.properties from $JBOSS_HOME/standalone/configuration  to $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/classes

 


(we will have to make this directory)

 


amghost3:Oracle ->> mkdir $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/classes

 


amghost3:Oracle ->> pwd

/home/oracle/jboss702/standalone/configuration

 


amghost3:Oracle ->> cp users.properties $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF/

 


amghost3:Oracle ->> cp roles.properties $JBOSS_HOME/standalone/deployments/apex.war/WEB-INF

 


 


amghost3:Oracle ->> pwd

/home/oracle/jboss702/standalone/deployments/apex.war/WEB-INF/classes

amghost3:Oracle ->> ls

roles.properties  users.properties

amghost3Oracle ->>

 


 


 


Now start the jboss agin and test the listenerAdmin tio verify the last puzle of user and roles:

 


cd $JBOSS_HOME/bin

 


./standalone.sh

 


and Wallah !! it works ..

 

 


It should work on Jboss 7.1 as well but if it does not then please comment and I will try tp see what need to be fixed !!

 


Happy sharing !!