Middleware
Application Server
Date: 1/18/06
Author: Jeff Trent/Debu Panda
OC4J supports ORMIS using two certificate stores namely Java KeyStore and Oracle Wallet. In this tutorial.This tutorial demonstrates Oracle's support for using RMI/SSL (ORMIS) for looking up remote objects using both mechanisms. Configuring certificate using either Java keytool or Oracle Wallet Manager is beyond the scope of this article. This example includes pre-configured certificates for demonstration purpose.
To enable, ORMIS you have to make the following changes in the config/rmi.xml
<rmi-server xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/rmi-server-10_0.xsd" port="23791" ssl-port="23943" <!—the default SSL server port for OC4J --> schema-major-version="10" schema-minor-version="0">
In an OracleAS managed install, the RMI/RMIS port defined in rmi.xml is ignored. make sure that you have defined port range rmis for your OC4J instance $ORACLE_HOME/opmn/conf/opmn.xml.
<port id="rmis" range="12701-12800"/>
<ssl-config keystore="location-to-the-keystore" keystore-password="server-key-password"/>
The location can either be an absolute path or relative path from the j2ee/home/config directory.You need the following in the client-side to use ORMIS protocol:
java -Djavax.net.ssl.keyStore=etc\keystore\client.ks -Djavax.net.ssl.keyStorePassword=clientkey HelloClientormis protocol in the provider URL as follows in the standalone: java.naming.provider.url=ormis://localhost/helloworld java.naming.provider.url=opmn:ormis//localhost:6003:home/ORMISFor further information on OC4J, see the following documents on OTN:
This demonstration requires that the following software components are installed and configured correctly:
The configuration files are located in the %HOWTO_HOME%/etc directory, including deployment descriptor files such as application.xml.
To run the sample application on a standalone instance of Oracle Application Server 10g 10.1.3 , follow these steps:
Ensure the following environment variables are defined:
For using ORMIS, you must configuration changes in the %ORACLE_HOME%/j2ee/home/config/rmi.xml to specify the ORMI/SSL port and key store configuration.
<rmi-server xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/rmi-server-10_0.xsd" port="23791" ssl-port="23943" <!—the default SSL server port for OC4J --> schema-major-version="10" schema-minor-version="0">
In an OracleAS managed install, the RMI/RMIS port defined in rmi.xml is ignored. Make sure that you have defined port range rmis for your instance $ORACLE_HOME/opmn/conf/opmn.xml.
<ssl-config keystore="location-to-the-keystore" keystore-password="server-key-password"/>
To run this example, we have included a pre-configured sample Oracle Wallet. To use this sample wallet, copy the wallets directory in %HOW_TO_HOME%/etc to %ORACLE_HOME%/j2ee/home <ssl-config keystore="../wallets/wallet-server-a/ewallet.p12" keystore-password="serverkey-a"/>Start OC4J stand alone using the following command after you make the above changes.
>%ORACLE_HOME%/bin/oc4j -start
If you are using an OracleAS managed install, start using the following command after you make the above changes.
> %ORACLE_HOME%/opmn/bin/opmnctl startall
Ant 1.6.2 is shipped with OC4J and you have to set your PATH environment variable to $ORACLE_HOME/ant/bin. On some operating systems, Ant does not currently support the use of environment variables. If this is the case for your operating system, please modify the ant-oracle.xml file located in the %HOWTO_HOME% directory.
Edit ant-oracle.properties (in the demo directory) and ensure the following properties are set to the correct values, as indicated below for OC4J standalone:
If you are using OracleAS managed install then you have appropriately change the following properties beside changing oc4j.admin.user and oc4j.admin.password for your managed OC4J instance in OracleAS install.
You have to uncomment appropriate deployer.uri in the ant-oracle.properties and make changes based on your environment i.e. a single instance OC4J or a clustered OC4J instance/group managed by OPMN .
You have to make changes in jndi.properties such as provider.url, principal and credential appropriate to your environment. If you are using OracleAS install, you have to use provider.url in the following format: opmn:ormis://localhost:6003:home/ORMIS.
To build the application, type the following command from the %HOWTO_HOME% directory:
>ant
You should now have the newly created ORMIS.ear in your %HOWTO_HOME%/lib directory.
This command will attempt to deploy the application archive if the build is successful. It will first test whether OC4J is running before attempting the deployment operation.
Note that you can also deploy the application separately . Ensure the %ORACLE_HOME% environment variable is defined, and from the %HOWTO_HOME% directory, type the command:
>ant deploy
Run the sample by running the command. Please make sure to change the jndi.properties file for any changes specific to your environment as we described in Client Side requirement section. Change the ant-oracle.xml to have appropriate Oracle Wallet information for your clients if you are not using the default client wallet shipped with the demo.
ant run
You will get the following output:
[java] client started...
[java] using ormis://localhost/helloworld
[java] Hello Scott
In this document, you should have learned :