July 18, 2007

Irritation Resolved

I spoke too soon.  In the last post I explained one of the irritations that I had with using ant.  You need to be in the directory that the build.xml was located before running the ant command. Well, upon further experimentation I discovered the option that can be used in conjunction with the ant command to deploy the process.

 

> ant -f /home/benjamgr/bpel/GetProfile/build.xml

 

If you use the -f option and give the full path and buildfile name you can execute the command from any directory.  How nice!  One of these days, I'll have to look at all the ant options to see what else can be done.  For now, this is all I need.

Command Line BPEL Deployment

Once you have all your environments set up as described in the previous post, It's time to copy your project files to that system.  Once this is done, go to the project's root directory.  List out the files to make sure that you see the build.xml and the build.properties file.  You can use the build.properties to override the system properties that are defined.  The build.xml file defines the exact steps that will be taken during the build process.  Once we get into the customized build we will see where and how to modify this file to accommodate our build variations.  Now your set to build.  To do that all you need to type in at the prompt is "ant".  You should see feedback that looks similar to the following:

Buildfile: build.xml

pre-build:

validateTask:
     [echo]
     [echo] --------------------------------------------------------------
     [echo] | Validating workflow
     [echo] --------------------------------------------------------------
     [echo]        
[validateTask] Validation of workflow task definitions is completed without errors

compile:
     [echo]
     [echo] --------------------------------------------------------------
     [echo] | Compiling bpel process GetProfile, revision 1.0
     [echo] --------------------------------------------------------------
     [echo]        
    [bpelc] validating "/home/benjamgr/bpel/GetProfile/bpel/GetProfile.bpel" ...
    [bpelc] BPEL suitcase generated in: /home/benjamgr/bpel/GetProfile/output/bpel_GetProfile_1.0.jar

deployProcess:
     [echo]
     [echo] --------------------------------------------------------------
     [echo] | Deploying bpel process GetProfile 
      [echo] --------------------------------------------------------------
     [echo]        
[deployProcess] Deploying process /home/benjamgr/bpel/GetProfile/output/bpel_GetProfile_1.0.jar
[deployProcess] Successfully deployed the process "GetProfile"

deployTaskForm:
     [echo]
     [echo] --------------------------------------------------------------
     [echo] | Deploying workflow form for GetProfile
     [echo] --------------------------------------------------------------
     [echo]        
[deployTaskForm] There are no forms to deploy

deployDecisionServices:
     [echo]
     [echo] --------------------------------------------------------------
     [echo] | Deploying decision services for GetProfile
     [echo] --------------------------------------------------------------
     [echo]        
[deployDecisionServices] There are no decision services to deploy

process-deploy:

post-build:

deploy:

BUILD SUCCESSFUL
Total time: 11 seconds

 

Irritation:

One thing I haven't been able to figure out is how to run the ANT build process without being in the very directory of the build.xml file.  I know there is a -find parameter that can be used, but I would like to specify the directory as part of the execution statement instead of changing directories to get the the appropriate place before running ant.  If you know how to get around this post a reply.

ANT - environment

If you've noticed, JDeveloper uses ANT for the purpose of deploying BPEL processes to the server.  Not only does ANT deploy the BPEL process, it also deploys the workflow forms and any decision services that might be included in your process.  Getting familiar with ANT is important if you want to deploy via command line or customize your deployment process.  As part of the test that I am doing on custom deployment of partner-links I have had the opportunity to experiment with ANT and discovered  a few "tricks" to get it to work in all your environments.

First, I found it necessary to set up my environment before I could use command-line ant.  Here is a list of things I needed (All my environments are Linux):

  • ORACLE_HOME - I defined this as the root Oracle Application Server location.
  • ANT_HOME - This defines the home where Apache Ant resides.
  • JAVA_HOME - I defined this so that I would use the same version of JAVA that the Oracle Application Server uses.
  • BPEL_HOME - The build.xml for your project will use this home.
  • PATH - I added JAVA bin and ANT bin directories to the PATH statement.

This is what my environment script ended up looking like:

ORACLE_HOME=/d01/oracle/product/10.1.3.1/iAS; export ORACLE_HOME
ANT_HOME=${ORACLE_HOME}/ant; export ANT_HOME
JAVA_HOME=${ORACLE_HOME}/jdk; export JAVA_HOME
BPEL_HOME=${ORACLE_HOME}/bpel; export BPEL_HOME
PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}; export PATH

 

Once you have your environment set up, you can do a few things to test.  Here's a short list of things I did to test if the env variables where what I wanted.

  • Run "java -version" - You should get a response like this:
  • java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

  • run "ant -version" - You should get a response like this: Apache Ant version 1.6.2 compiled on March 19 2005
  • run "echo $BPEL_HOME" to verify that you have this set correctly.

Lastly, you should go to the $BPEL_HOME/utilities directory and open the ant-orabpel.properties file and verify that all the values (especially admin.password) are set correctly.

Once you have done all of the above, you should be ready to see if your command line deployment of a bpel process is working correctly.