Package java classes (WSIF calls) in BPEL suitcase 250 365 Bricks 42475556801

Package java classes (WSIF calls) in BPEL suitcase

Introduction

Is it possible to package java classes which are invoked through WSIF along with the BPEL Suitcase generated by bpelc?

I’ve noticed that when generating and deploying the suitcase using JDeveloper (10.1.3.x) – the class files are compiled to the output directory and packaged in the suitcase, but when I run the same build.xml via Ant (ant deploy-process), the class files are missing in the output directory and thus missing in the suitcase

So, the question is what causes the difference and how can I achieve packaging the class files using Ant without Jdeveloper.

Apparently, the bpelc tasks can have nested elements of type zipfileset. (See the Ant documentation about this type). In here is the solution. Because there Oracle forgot to document and publish anything about the bpel ant tasks, I’ve decompiled the orabpel.jar package into it’s source files. By browsing through the files (Bpelc.java), you can find out what (command line) options are valid and what they are capable of (sort of).

Here is a how-to

You have to change the jdeveloper generated build.xml.

1st you have to add a “javac” task (if not already there) like below, and add it to build.xml:

<target name="java-compile" description="Compile Java source files">
   <echo>
--------------------------------------------------------------
| Compiling java source files
--------------------------------------------------------------
   </echo>
   <javac destdir="${process.dir}/output" encoding="UTF-8" source="1.5" target="1.5">
     <src path="src"/>
   </javac>
</target>

2. Extend target “process-deploy” to depend it on target “java-compile”.

It is important that the java gets compiled before the bpelc is executed. Like so:

<target name="process-deploy"
        depends="validateTask, java-compile, compile, deployProcess, deployTaskForm, deployDecisionServices" />

3. Change the bpelc task by including a nested classes element that includes your class files, like so:

<bpelc input="${process.dir}/bpel/bpel.xml"
       out="${process.dir}/output"
       rev="${rev}"
       home="${bpel.home}">
   <classes dir="${process.dir}/output" includes="**/*.class"/>
</bpelc>

When you run target “process-deploy”, the class files are added to the bpel suitcase.

Further notice

Naturaly, if your class files are so generic that there can be used in other BPEL processes as well, the better option would be to jar the classes separately and put them in the $BPEL_HOME/lib directory where they are usable to all BPEL processes on the instance. This is instead of redundantly packaging the same classes in each BPEL suitcase.