There is a built-in utility to browse/move/delete(drain) messages from JMS queues and topics inside OracleAS OC4J. Starting of the utility has changed a little bit from version 10.1.2 but the usage is the same.
For those that want the fast way of starting up this utility, here is a sample Windows command file:
Create a new file, e.g. called JMSUtils.cmd and the contents:
@REM JMSUtils.cmd
@REM This script will launch OracleAS OC4J 10.1.3. JMS command line utility
@REM History:
@REM 4.6.2008 Harri Kaukovuo, Oracle Finland Oy
@set J2EE_HOME=D:\product\10.1.3.1\OracleAS_1\j2ee\home
@setlocal
@set CLASSPATH=%J2EE_HOME%\oc4j.jar;%J2EE_HOME%\oc4j-api.jar;%J2EE_HOME%\oc4jclient.jar;%J2EE_HOME%\rmic.jar;%J2EE_HOME%\lib\adminclient.jar;%J2EE_HOME%\lib\connector.jar;%J2EE_HOME%\lib\javax77.jar;%J2EE_HOME%\lib\jmxri.jar;%J2EE_HOME%\lib\oc4j-internal.jar
@java com.evermind.server.jms.JMSServerUtils -username oc4jadmin -password yourpassword -port 12601 %*
@endlocal
You need to replace the value for J2EE_HOME to point to your OracleAS OC4J home directory. By default this utility points to the local host, but you need to connect remote OC4J please add extra "-host myhost.com" as startup uption. To determine the right JMS server port, please see the following chapter.
Determing JMS server port
OPMN
Depending on the installation (SOA Suite basic, advanced, WebCenter, standalone OC4J), the JMS server setting might be different. One of the easiest way to determine this when running a real OracleAS installation is to use OPMN command line tool:
opmnctl status -fmt %por
Processes in Instance: soasuite.hkaukovu-fi
-----
ports
-----
N/A
jms:12601,http:8888,rmis:12701,rmi:12401
As you can see, the JMS server port among others is reported as an output. You should use the jms:XXXX value in the JMSUtils.cmd command script as -port option.
opmnctl is found under $ORACLE_HOME/opmn/bin.
Standalone OC4J
If you are running standalone OC4J (not installed using Oracle Universal Installer), you should look for $OC4J_HOME/j2ee/home/config/jms.xml file. The entry
<jms-server port="9129">
will show you the port number.
In the above sample the "home" in the path $OC4J_HOME/j2ee/home/config points to the default OC4J instance name "home". In case you have multiple OC4J instances you might be different subdirectories for each instance (like oc4j_soa etc).
Please be aware that if you use OPMN to control the instance, the value in jms.xml will be overriden by OPMN driven values derived from opmn.xml "<port id="jms" range="12601-12700"/>".