06 February 2007

Specifying OC4J standalone ports from the command line

We get asked from time to time whether its possible to specify the port values for OC4J standalone to use when it is started, instead of using what's in the configuration files.

The answer is yes but it's nothing you'll find documented anywhere I've seen.

Typically the ports used by OC4J are defined in the various configuration files that reside in the j2ee/home/config directory.

RMI(S): rmi.xml
JMS: jms.xml
HTTP: default-web-site.xml

Any or all of these port values can be overridden when OC4J is started by supplying an additional startup string that looks like this:

>java -jar oc4j.jar -properties -ports default-web-site:http:80,rmi:1200,rmis:1201,jms:1202

Note: this mechanism is for the 10.1.3 release.

The string basically specifies the "protocol" and the "port" to use for the protocol. The slight variance is with default-web-site:http: entry. This is because there can be multiple web-sites for an OC4J instance, so the id/name of the web-site is needed.

>java -jar oc4j.jar -properties -ports default-web-site:http:5550,rmi:5551,rmis:5552,jms:5553

>netstat -a | grep 555
TCP sbutton-au:5550 sbutton-au:0 LISTENING
TCP sbutton-au:5551 sbutton-au:0 LISTENING
TCP sbutton-au:5552 sbutton-au:0 LISTENING
TCP sbutton-au:5553 sbutton-au:0 LISTENING

No comments: