How does
extensible markup language relate to the J2EE standalone version of Application
Server? If "extensible markup language" sounds unfamiliar to you, perhaps
you know it better by its acronym of XML. XML matters not to just to the J2EE
version of Application Server, but to all versions. The manner in which XML matters
is fairly significant: many configuration files are XML-based. If your DBA
responsibilities include administering J2EE applications based upon Application
Server, you face the learning hurdles of XML, Java and J2EE, how Oracle
interfaces with Java (OC4J, more on that later), and Application Server itself.
Chances are you have seen XML in action and may not have even noticed it.
Oracle 10g's staging information uses a file named products.xml instead of
products.jar.
If coming
from a Forms and Reports Services standalone background, the J2EE version will be
somewhat familiar, but even within this "known" territory, there are
many differences. For example, using true or false: all versions of Application
Server are installed using Oracle Universal Installer, so all you ever need to
look for in the "Disk 1" directory is the setup.exe (or runInstaller)
executable? As we will see later on, the answer is false.
This
article is the first of a multi-part series focusing on Oracle's more Web-like
version of Application Server, J2EE applications, and XML. Being able to
differentiate the versions of Application Server (what is common, what is
different), basic administration (using XML configuration files), performing a
new type of installation, and acquiring an XML editing tool (free and lasts
forever) are some of the topics that will be covered.
The different flavors of Application Server
Which
version do you need, is it part of a bundle, and does it come in a standalone
version? Part of the answer is shown in the version comparison matrix found
under the Middleware (not Applications) link under "Products" at www.oracle.com (see http://www.oracle.com/appserver/appserver_family.html).
Scrolling
down a bit on the page, the OC4J version shows the following availability by version.
|
Oracle Application Server Containers for J2EE (OC4J)
|
Version Availability
|
|
Java
|
SE/SE1
|
EE
|
Standalone
|
|
Fastest J2EE-certified Java environment with support for
Web services (UDDI, SOAP and WSDL), Fast Start Fault Recovery Architecture,
cluster support for JSPs, servlets, and EJBs, and J2EE-based security
framework.
|
Yes
|
Yes
|
Yes
|
NA
|
Under
product information for Application Server at OTN, you can expand a list of
features for each version. The two tables below show a consolidated listing for
each type. Common elements are aligned at the top.
|
Application Server 10g
Release 2
|
J2EE and Web Cache
|
|
Oracle HTTP Server Oracle Application Server Containers
for J2EE (OC4J)
Oracle Application Server Web Cache
Oracle Enterprise Manager 10g Application Server Control
OracleAS Backup and Recovery Tool
Oracle
Application Server Portal
Oracle
Application Server Wireless
Oracle
Sensor Edge Server
Oracle
Database Server 10g (10.1.0.4.2)
Oracle
Internet Directory
Oracle
Application Server Single Sign-On
Oracle
Application Server Directory Integration Provisioning
Oracle
Application Server Delegated Administration Services
Oracle
Application Server Certificate Authority
Oracle
Application Server Forms Services
Oracle
Application Server Reports Services
Oracle
Application Server Personalization
Oracle
Business Intelligence Discoverer
Oracle
Security Developer Tools
Oracle
Application Server Guard
|
Oracle Application Server Containers for J2EE
Oracle HTTP Server Oracle Web Cache
Oracle Enterprise Manager 10g Application Server Control
OracleAS Backup and Recovery Tool
OracleAS
Upgrade Assistant and Upgrade Plug-Ins
OracleAS
Change IP/Host Name Tool
OracleAS
Cloning Scripts
Oracle
XML Developer's Kit
|
|
Oracle
Application Server 10g Release 2 (10.1.2.0.1) Standard Edition One
|
Oracle
Application Server J2EE Downloads
Pure
Java - Runs on all certified Platforms
|
|
Oracle HTTP Server
Oracle Application Server Containers for J2EE (OC4J)
Oracle Application Server Web Cache
Oracle Enterprise Manager 10g Application Server Control
Oracle
Application Server Portal
Oracle
Database Server 10g
Oracle
Internet Directory
Oracle
Application Server Single Sign-On
Oracle
MapViewer
|
Oracle HTTP Server
Oracle Application Server Containers for J2EE
Oracle Application Server Web Cache
Oracle Enterprise Manager 10g Application Server Control
|
The J2EE
downloads (pure Java) version is of interest to us in that this version
installs without Oracle Universal Installer. Click the "Pure Java"
link and you will see several standalone versions (the product comparison
matrix is somewhat misleading given that there is, in fact, a standalone
version). Version 10.1.2.0.2 is a quick download (just over 35MB) and results
in a compressed file named oc4j_extended.zip.
Reader's
Note: For the purposes of this particular article, it is not necessary to
install this product finish reading before deciding whether or not you want
to sample this version.
One thing
to take note of is that Oracle Corporation is not consistent in how it refers
to features. Sometimes OC4J is used, sometimes not. Is it Application Server
Web Cache, or HTTP Server Web Cache?
Installing Oracle Application Server Containers for J2EE
Expand
the zipped file and open the Readme.txt file. I staged the uncompressed version
of the download under C:\oracle\oc4j. To perform the installation, you need the
Java "java" executable (may have to add the C:\Program Files\Java\jdk1.5.0_02\bin
folder to your path). To test your environment and setup, run "java
version" at a command prompt.
C:\>java -version
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
In the
j2ee\home directory, start the installation with java jar oc4j.jar install.
C:\oracle\oc4j\j2ee\home>java -jar oc4j.jar -install
Auto-unpacking C:\oracle\oc4j\j2ee\home\applications\dms0.war... done.
To enable in-process JSP compilation (which can be faster in some cases),
please add the path to your tools.jar in application.xml
Example: <library path="../../../jdk/lib/tools.jar" />
Enter an admin password to use: oracle
Confirm admin password: oracle
If you are using J2SE 1.4 or higher, please ensure that all your imported classes are
with in packages, as required by the Java Language Specification.
Installation done
C:\oracle\oc4j\j2ee\home>
If the
installation was successful, the next step is to test it by starting an OC4J
instance. This part should be familiar to Forms developers running a Developer
Suite OC4J instance (used to run Forms on the Web without using Application
Server).
C:\oracle\oc4j\j2ee\home>java -jar oc4j.jar
06/01/08 18:48:18 Oracle Application Server Containers for J2EE 10g (10.1.2.0.2) initialized
06/01/08 18:48:18 !!! No valid java compiler found !!!
06/01/08 18:48:18 javac.exe not found under C:\Program Files\Java\
jre1.5.0_02, please use a valid jdk or specify the location of your java
compiler in server.xml using the <java-compiler .../> tag
Note the
error about javac.exe not being found under C:\Program Files\Java\jre1.5.0_02. Let's
see, which version JDK or JRE does javac come with? That would be JDK, so
why is Oracle looking for javac under a Java Runtime Environment (JRE)
installation path? I have JDK listed first in my path statement, not JRE, but
that doesn't make a difference. The Standalone User's Guide (installs with the
product) even mentions JDK as being a prerequisite, yet Oracle is looking for
javac under JRE. Anyway, this leads into one of the topic areas for this
series, namely that of XML-based configuration files.
XML Configuration Files
For an
overview of all the files involved, Figure 2-1 shows a good representation. The
specifics of these files will be covered later (along with an XML editor), but
for now, the server.xml is what needs our attention.
The
server.xml file is located in J2EE_HOME\j2ee\home\config, which resolves to C:\oracle\oc4j\j2ee\home\config
given that I used C:\oracle\oc4j as my Oracle, oops, make that J2EE, home. The
error message stated that a java-compiler tag needs to be used to set the JDK
location. The default server.xml file does not contain this directive (more on
what a directive is later, but for now, consider it to be a very close cousin
of an HTML tag), so it must be added.
The
contents of the server.xml file are shown below.
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE application-server PUBLIC "Orion Application Server Config"
"http://xmlns.oracle.com/ias/dtds/application-server-9_04.dtd">
<application-server application-directory="../applications"
deployment-directory="../application-deployments" connector-directory="../connectors">
<rmi-config path="./rmi.xml"/>
<!-- JMS-server config link, uncomment to activate the JMS service -->
<jms-config path="./jms.xml"/>
<j2ee-logging-config path="./j2ee-logging.xml" />
<log>
<file path="../log/server.log"/>
</log>
<global-application name="default" path="application.xml"/>
<global-web-app-config path="global-web-application.xml"/>
<!-- <web-site path="./secure-web-site.xml" /> -->
<web-site path="./http-web-site.xml"/>
<!-- Uncomment the following, to deploy these apps.
<application name="callerInfo" path="../jazn/demo/callerInfo/callerInfo.ear" />
<application name="ssoInfo" path="../jazn/demo/ssoInfo/build/ssoInfo.ear" />
<application name="ejbsamples" path="../demo/ejb" />
<application name="news" path="../applications/news.ear" />
<application name="logger" path="../demo/messagelogger.ear" />
<application name="petstore" path="../applications/estore-patched.ear" />
<application name="ws_example" path="../demo/web_services/java_services/ws_example.ear" />
<application name="ojspdemos" path="../demo/ojspdemos.ear" />
-->
<!-- Compiler, activate this to specify an alternative compiler such
as jikes for EJB/JSP compiling. -->
<!-- <compiler executable="jikes" classpath="/myjdkdir/jre/lib/rt.jar" /> -->
</application-server>
Directives,
just like tags in HTML, have beginning and ending parts. Some tags are
self-closing, like "br" , and some are not, like "table."
With the server.xml file, the configuration part is between the "application-server"
tags. Somewhere in between the opening and ending is good enough as far as
adding java-compiler tag. Three usage notes for adding the java-compiler tag
include:
-
Provide a name
of the compiler ("javac" in this case)
-
Provide a path
name using "bindir"
-
For
Windows-like paths, escape the back-slash character with another back-slash
character
An
example is shown below.
<j2ee-logging-config path="./j2ee-logging.xml" />
<java-compiler name="javac"
bindir="C:\\Program Files\\Java\\jdk1.5.0_02\\bin" />
<log>
<file path="../log/server.log"/>
</log>
Let's
restart the OC4J instance and see what happens.
C:\oracle\oc4j\j2ee\home>java -jar oc4j.jar
06/01/08 20:52:37 Oracle Application Server Containers for J2EE 10g (10.1.2.0.2) initialized
Looks
like a clean start. At this point, the basic webapp should be available. Access
it via a URL of http://localhost:8888.
As
another example, the Standalone User's Guide should be available at http://localhost:8888/standaloneguide.pdf.
This URL suggests that where the PDF is located is also the Web server document
root. The root (for me) is C:\oracle\oc4j\j2ee\home\default-web-app, and a
simple test of trying to access other files within the default-web-app
directory should prove this to be true.
Where is
Enterprise Manager for this version of Application Server? Despite Oracle's Web
site saying this version includes Enterprise Manager, it does not. The next
version up J2EE and Web Cache is the minimum version type to get Enterprise
Manager.
Just for
grins, if you note that the contents of the server.xml file remind you of a
simple HTML file, try opening this (or any) XML file in a browser.
In Closing
So far, we
have seen a listing of the features included in the four types of installation
for Application Server. Applications can be deployed via the standalone OC4J
version, and administration can be performed via the direct editing of (many)
XML files. Knowing the specifics of XML is not necessary, but it certainly
helps to have an appreciation of the who-what-where of what Enterprise Manager
changes when you, as the administrator, are making changes via the EM console.
»
See All Articles by Columnist Steve Callan