Thursday, July 12, 2007

How to Enable SSL for OC4J on local server

  1. The first that you need to know is the path of the configuration directory of your OC4J instance. You can check that when your OC4J instance starts. See the following image.

  1. Open a prompt command and go to OC4J config directory. Here you will use SUN’s keytool to create the certificate. Type the following command line as it’s shown on the following screen shot.
  1. When you execute the command line, a couple of question will be prompted by keytool. Answer these questions as you please. A new file is created in the current directory (its name is sslfile) See the following screen shot

  1. If you don’t already have a secure-web-site.xml file in your OC4J config directory, create one by copying the existing http-web-site.xml and renaming the copy to secure-web-site.xml
  1. Edit secure-web-site.xml and add the following:
    1. Add secure=”true” to the website element.
    2. Use an available port. The default for SSL is normally 443, but you have to be a super user to use it, I therefore used (4443)
    3. Add the following lines inside the web-site element use the keystore name and password you used when creating the certificate.

The files should look like this:

  1. Edit the server.xml file and uncomment or add the following line:

  1. Save the changes. The server.xml file should look like this:

  1. Restart OC4J. Now OC4J will listen for both SSL request (port 4443) and non-SSL requests (port 8990). In my case the urls would be:
    1. http://localhost:8990/AppName/Index.do
    2. https://localhost:4443/AppName/Index.do

No comments: