Creating a New OC4J Instance

Your Java-based applications must be associated with an OC4J instance when they are deployed to Oracle Application Server 10 g. The OC4J instance has a set of properties that all applications that are deployed under them inherit. In a moment, we will look at the properties that are associated with each OC4J instance. The easiest way of creating a new OC4J instance is to create one by way of the Oracle Enterprise Manager Application Server Control web site. Point your browser to

 http://<mid-tier server>:1810 

You will need the ias_admin password. If you do not have that password, contact your system administrator. If both the infrastructure and the middle tier are on the same server, you are presented with a Farm page. Select the mid-tier instance. You will see a page similar to Figure 15-2.

click to expand
Figure 15-2: The mid-tier components page

On this page, you can create a new OC4J instance. One OC4J instance can have multiple applications deployed to it, so we could use one of the existing OC4J containers to deploy our applications, but this is not a good idea. The parameters for the existing OC4J containers have been optimized for the applications that Oracle provides for you as part of the Oracle Application Server installation (things like the Forms server and the Portal environment). It s best to go ahead and create a new OC4J container for your application.

To create a new OC4J instance, click the Create OC4J Instance button on the right of the page. Give the OC4J instance a meaningful name . Traditionally, developers give their instance an OC4J_ prefix, but that is not required. Click the Create button. The Oracle Application Server will then create the instance and the directory structure on the server to support your new instance. After a few seconds, the Confirmation screen will display. After clicking OK, you will be returned to the main components screen for the middle tier with your new OC4J instance displayed (for this example, it is called OC4J_HockeyApp (Figure 15-3).

click to expand
Figure 15-3: The mid-tier components page with the new OC4J instance displayed

If you prefer command-line tools, you can create a new OC4J instance by way of the dcmctl command-line utility. You will find this executable (for Windows) or .sh script (for Unix/Linux) in the <ORACLE_MID-Tier_HOME>/dcm/bin directory. To create a new OC4J component named OC4J_HockeyApp, use the following syntax:

 C:\AS_HOME\dcm\bin>dcmctl createcomponent -ct OC4J -co OC4J_HockeyApp 

The -ct switch is used to specify the component type (OC4J) you wish to create, and the -co switch specifies the component s name.

Returning to the Enterprise Manager Application Server Control web site, click the link for the new OC4J instance, then click the Administration tab along the top of the screen (Figure 15-4). Here, we can set values for all of the attributes for the instance. Of particular interest is the Data Sources link. This link allows us to create a new data source based on an existing data source in the data-sources.xml file. This page allows us to edit the file graphically through the web interface, making the need to grant telnet access to the server (if the server is Unix-based) or leaving the directory open as a shared directory (if the server is Windows-based) unnecessary for developers who need to make modifications to any of these files.

click to expand
Figure 15-4: The Administration tab of the new OC4J instance

Click on the Applications tab (Figure 15-5) to see a list of the applications that have been deployed to this OC4J instance. Alternatively, you could use the listapplications switch of the dcmctl executable/shell script to see that information:

 dcmctl listapplications -co OC4J_HockeyApp 
click to expand
Figure 15-5: The deployed applications tab of the OC4J instance named OC4J_Portal


Oracle Application Server 10g Web Development
Oracle Application Server 10g Web Development (Oracle Press)
ISBN: 0072255110
EAN: 2147483647
Year: 2004
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net