|
Setup
This section explains the steps to install and configure
the FBS sample application. It contains the following sections:
Note: Steps for setting up the FBS on Oracle9iAS
Java Edition are provided in a separate document: /sample_code/tech/java/j2ee/fbs/docs/InstallJE.html.
Terminology
| Term |
Definition |
|
<JDEV_HOME>
|
The directory where Oracle9i JDeveloper is installed. (example D:\JDev903)
|
|
<OC4J_HOME>
|
The directory where OC4J is installed. (example E:\oc4j903)
|
|
<J2EE_HOME>
|
The directory j2ee/home under <OC4J_HOME> (example E:\oc4j903\j2ee\home)
|
|
<SAMPLE_HOME>
|
The directory where the source files of the sample have been extracted
to. (example C:\ibfbs)
|
Extracting the Source Code
Execute the following command to extract the files:
>jar xvf ibfbs.jar
All the files are extracted into the ibfbs directory.
Configuring the Application
- Connect to your database and run one of the following
SQL scripts to create and populate a schema named IBFBS/IBFBS.
-
For Oracle9i v9.2.x, run
<SAMPLE_HOME>/sql/ibfbs.sql
-
For any other version of Oracle, run
<SAMPLE_HOME>/sql/ibfbs_others.sql
- Edit
<SAMPLE_HOME>/etc/Connection.properties
to provide data appropriate for your system. Comments in the file give specific
instructions.
Note: The next two steps are required only if you want
to set up a B2B scenario where one FBS communicates with another FBS via Web
Services. To setup a B2B scenario, deploy and run the FBS in two or more different
application server instances. Each database schema must also be unique.
-
Edit <SAMPLE_HOME>/src/public_html/wsdl/Exchange.wsdl
and replace the value of the location attribute in the <soap:address>
tag with the correct host and port where the application server is running.
Example:
<soap:address location="http://www.yourdomain.com:8888/ibfbs/ExchangeService"/>
-
Edit <SAMPLE_HOME>/src/oracle/otnsamples/ibfbs/trademanagement/ejb/ExchangeStub.java
and provide appropriate values for the hostname and port of endpoint member
parameters.
Example:
public String endpoint = "http://www.yourdomain.oracle.com:8888/ibfbs/ExchangeService";
Deploying the
Application
The application can be deployed to an OC4J instance
in either of the following ways
Deploying to the Embedded
OC4J
-
Open FBS.jws with Oracle9i JDeveloper.
-
Edit buildJDev.xml (FBSProject->AntBuildfiles) and set
the property value of jdev.home to <JDEV_HOME>
-
Move the downloaded googleapi.jar to <JDEV_HOME>/j2ee/home/lib
-
Add GoogleAPIs to CLASSPATH.
-
Right-click FBSProject.jpr. Choose Project Settings
from pop-up menu
-
Go to Configurations->Development and click on Libraries
node.
-
Next, click the New button in this dialog box. The New library
dialog pops up. Enter library name as Google API. Click on Edit
button for CLASSPATH entry. In the Edit Class Path window, click
Add Entry button and specify the path of the downloaded googleapi.jar.
Click OK for all other open windows.
- Edit
<JDEV_HOME>/j2ee/home/config/data-sources.xml to
point to the same database used in step 1 of Configuring
the Application by changing the value of the attribute url
to the corresponding host, port, and SID. Change the username to ibfbs
and password to ibfbs. Set the class attribute to
oracle.jdbc.pool.OracleDataSource for better performance.
<data-source
class="oracle.jdbc.pool.OracleDataSource"
name="OracleDS"
location="jdbc/OracleCoreDS"
xa-location="jdbc/xa/OracleXADS"
ejb-location="jdbc/OracleDS"
connection-driver="oracle.jdbc.OracleDriver"
username="ibfbs"
password="ibfbs"
url="jdbc:oracle:thin:@<host-name>:<port>:<sid>"
inactivity-timeout="30"
/>
-
Start the embedded OC4J with the -userThreads option.
<JDEV_HOME>/j2ee/home> java -jar oc4j.jar -userThreads
- Create a connection to embedded OC4J and deploy.
- Right-click
ibfbs.deploy file (FBSProject
> Deployment) and select deploy to > New Connection.
- This brings up the Connection Wizard. Click Next
- In the first panel (after the Welcome panel, if displayed)
name the connection embOC4J. Set Connection Type to Standalone
OC4J. Click Next.
- In the second panel, enter the username as admin
and the corresponding password (default: welcome). Click on Next.
- Accept all defaults in panel 3. Click Next.
- In panel 4 you can test the connection. Click Finish.
This will complete the application deployment to the embedded OC4J server.
You can access the application following the steps given in the section
Running in OC4J.
EAR (Enterprise Application
aRchive) Deployment
-
Edit <SAMPLE_HOME>/build.xml and set the property value
for oc4j.home to <OC4J_HOME>
-
Move the downloaded googleapi.jar to <J2EE_HOME>/lib
-
Run Ant (from <SAMPLE_HOME>) to build the EAR file.
> ant -buildfile build.xml
- Edit
<JDEV_HOME>/j2ee/home/config/data-sources.xml
to point to the same database used in step 1 of Configuring
the Application by changing the value of the attribute url
to the corresponding host, port, and SID. Change the username to ibfbs
and password to ibfbs. Set the class attribute to
oracle.jdbc.pool.OracleDataSource for better performance.
<data-source
class="oracle.jdbc.pool.OracleDataSource"
name="OracleDS"
location="jdbc/OracleCoreDS"
xa-location="jdbc/xa/OracleXADS"
ejb-location="jdbc/OracleDS"
connection-driver="oracle.jdbc.OracleDriver"
username="ibfbs"
password="ibfbs"
url="jdbc:oracle:thin:@<host-name>:<port>:<sid>"
inactivity-timeout="30"
/>
- Start OC4J with the -userThreads option.
> java -jar oc4j.jar -userThreads
- Deploy the EAR to OC4J and bind the Web application to
a Web site.
> java -jar <J2EE_HOME>/admin.jar ormi://<hostname>:<ormi-port> <username>
<password> -deploy -file <SAMPLE_HOME>/lib/ibfbs.ear -deploymentName ibfbs
> java -jar <J2EE_HOME>/admin.jar ormi://<hostname>:<ormi-port> <username>
<password> -bindWebApp ibfbs ibfbs-web http-web-site /ibfbs
where
<hostname> - Machine name where OC4J
is running
<ormi-port> - ORMI port number of OC4J (default: 23791)
<username>- OC4J Admin username (default: admin)
<password>- Password for Admin user
Example:
> java -jar D:\oc4j\j2ee\home\admin.jar ormi://localhost:23791 admin welcome
-deploy -file ibfbs.ear -deploymentName ibfbs
> java -jar D:\oc4j\j2ee\home\admin.jar ormi://localhost:23791 admin welcome
-bindWebApp ibfbs ibfbs-web http-web-site /ibfbs
JSP Pre-Translation
This step is optional. JSP pages are typically used in an
on-demand scenario, where pages are translated as they are invoked, in a sequence
that is transparent to the user. An alternative is to pre-translate JSP pages
using the OC4J JSP Translator. Doing so can save end users the translation overhead
the first time a page is executed. OC4J JSP translator compiles the translated
Java source files into Java classes using a Java compiler, so any compilation
errors will be visible during the pre-translation process.
- Set CLASSPATH to include
ojspc.jar, servlet.jar and
oc4j.jar.
On Windows,
> set CLASSPATH=<J2EE_HOME>\lib\ojsp.jar;<J2EE_HOME>\lib\servlet.jar;<J2EE_HOME>\oc4j.jar;%CLASSPATH%;
On Unix,
> CLASSPATH=<J2EE_HOME>/lib/ojsp.jar:<J2EE_HOME>/lib/servlet.jar:<J2EE_HOME>/oc4j.jar:$CLASSPATH:
> export CLASSPATH
- Create a directory to hold the generated binary and source
files.
On Windows,
J2EE_HOME> md application-deployments\ibfbs\ibfbs-web\persistence
J2EE_HOME> md application-deployments\ibfbs\ibfbs-web\persistence\_pages
On Unix,
J2EE_HOME> mkdir application-deployments/ibfbs/ibfbs-web/persistence
J2EE_HOME> mkdir application-deployments/ibfbs/ibfbs-web/persistence/_pages
- Translate JSPs from the directory where the application
has been deployed (
<J2EE_HOME>/applications/ibfbs/ibfbs-web).
> java oracle.jsp.tools.Jspc -addClasspath ./WEB-INF/classes;./../ibfbsEJB.jar; -d ./../../../application-deployments/ibfbs/ibfbs-web/persistence/_pages -srcdir ./../../../application-deployments/ibfbs/ibfbs-web/persistence/_pages -verbose jsps/*.jsp
where
-d
- specifies the location where the generated binary files (*.class and
resource) must be placed.
-srcdir
- specifies the location where the generated source files ( *.java and
*.sqlj ) must be placed.
Running in
OC4J
The application can be accessed using a URL in the following
form:
http://<hostname>:<port>/ibfbs/controllerservlet
|