August 20 2015

While testing the Maven build scripts I shared in my previous post, I found a few issues while building more complex composite projects.  Both of the issues I found were related to included Java code in the project. One of which has a work around while the other does not.

The first issue was with using the Java Embedding activity in a BPEL process.  This results in a Java class being generated for the BPEL process, which then was failing to compile.

The second issue was with custom Java classes in the SOA composite project which were then used in a Spring component.  These classes were not being compiled, causing an exception at run time when the spring bean was invoked.

BPEL and Java Embedding

Inside that activity I put a simple System.out.prinln as shown:

Now, when I try to build the project using the default Maven POM file with no changes I receive the following error:

[INFO] [exec] /home/adesjard/jdeveloper/mywork/SOAApplication/SOAProject1/SOA/SCA-INF/bpel/
error: package com.collaxa.cube.engine.ext.bpel.v1.nodes does not exist
[INFO] [exec] /home/adesjard/jdeveloper/mywork/SOAApplication/SOAProject1/SOA/SCA-INF/bpel/
error: package does not exist
[INFO] compile: [cmd:[/opt/oracle/java/jdk1.7.0_76/jre/bin/java,|oracle.fabric.common.classloaderurl.handler
|oracle.fabric.common.uddiurl.handler, oracle.soa.scac.ValidateComposite, 
/home/adesjard/jdeveloper/mywork/SOAApplication/SOAProject1/SOA//composite.xml, -level=1]] exit code=1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.445s
[INFO] Finished at: Tue Aug 18 16:15:45 CDT 2015
[INFO] Final Memory: 17M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
(default-compile) on project SOAProject1: SOA COMPILE FAILED with value: 1 -> [Help 1]

As you can see above the compile fails to compile. It looks like the required libraries containing the com.collaxa.cube.engine.ext.bpel.v1.nodes and packages are not available on the classpath of the SCA compiler.

Unfortunately, this has been reported as Bug 20229616 with Oracle previously and has not been resolved yet.

For now you should avoid using the Java Embedding activity in your SOA 12c projects if you want to be able to build the projects with Maven.

Spring Components

The second issue arose when I tried to use a Spring component as an alternative to the Java Embedding activity.

I created a simple Java class called LoggerBean as an example in my SOA composite project as shown below:

After setting up a Spring context exposing this bean as a SCA service, I added Assign and Invoke activities:

We can now see that the project builds fine:

[INFO] --- oracle-soa-plugin:12.1.3-0-0:sar (default-sar) @ SOAProject1 ---
[INFO] Building sar: /home/adesjard/jdeveloper/mywork/SOAApplication/SOAProject1/target/sca_SOAProject1_rev4.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.927s
[INFO] Finished at: Tue Aug 18 16:25:58 CDT 2015
[INFO] Final Memory: 16M/438M
[INFO] ------------------------------------------------------------------------
Process exited with exit code 0.

But when we try and deploy the composite to the server we will get the following error:

Deploying on partition "default" of "/Domain_bpm_domain/bpm_domain/soa_cluster" ...
Deploying on "/Domain_bpm_domain/bpm_domain/soa_cluster" failed!
There was an error deploying the composite on soa_server1: Deployment Failed: 
Error occurred during deployment of component: 
Spring1 to service engine: implementation.spring for composite: SOAProject1: 
SCA Engine deployment failure.: org.springframework.beans.factory.CannotLoadBeanClassException: 
Cannot find class [com.avioconsulting.LoggerBean] for bean with name 'loggerBean' defined in URL 
nested exception is oracle.classloader.util.AnnotatedClassNotFoundException:
         Missing class: com.avioconsulting.LoggerBean
        Dependent class: org.springframework.util.ClassUtils
         Loader: sun.misc.Launcher$AppClassLoader@828263870
         Code-Source: /opt/oracle/product/oracle_home/oracle_common/modules/org.springframework_3.1.0.jar
         Configuration: /opt/oracle/product/oracle_home/oracle_common/modules/org.springframework_3.1.0.jar
This load was initiated at default.composite.SOAProject1.soa_99a99cb4-a00b-47ae-bec5-36d0ca856cf0:4.0-SNAPSHOT 
using the loadClass() method.

Fortunately, this issue does have a workaround.  While trying to resolve this issue I found that although the sourceDirectory is being set to SOA/SCA-INF/src and the outputDirectory is set to SOA/SCA-INF/classes in the POM file, the Java compile goal is never executed.  This is because the packaging for the POM is defined as sar which causes the oracle-soa-plugin:12.1.3-0-0:compile goal to be executed instead.

In order to work around this issue, you can add the following plugin definition to your POM which will run the Java compile goal after the SOA compile goal has completed.  


You should then see output like below during your build and have your compiled Java classes inside of your SAR file.

[INFO] --- maven-compiler-plugin:3.3:compile (compile-soa-java) @ SOAProject1 ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /home/adesjard/jdeveloper/mywork/SOAApplication/SOAProject1/SOA/SCA-INF/classes

By adding in this additional maven-compiler-plugin execution you will now be able to build projects that contain Spring components and Java source code using Maven.  Unfortunately there is no current workaround for using the Java Embedding activity and building with Maven, so until that bug has been resolved in a future bundle patch it is best to avoid using Java Embedding when possible.

About the Author

Adam Desjardin

Adam DesJardin is the Chief Technology Officer for AVIO Consulting.  Adam focuses on technical strategy, standards and delivery both within AVIO and for our customers.  Prior to joining AVIO in 2007, Adam held various consulting and architecture positions at Fuego and BEA Systems where he developed and delivered process and service driven solutions.

Join the Conversation

October 5, 2015

Thanks for the tips. This is useful.

January 24, 2016

Is the patch is available now? Im facing the same problem.  Please help me

July 23, 2016
Hey very nice blog!! Man .. Excellent .. Amazing .. I will bookmark your site and take the feeds alsoI'm satisfied to find a lot of useful info right here within the post, we'd like develop extra strategies in this regard, thanks for sharing. aaadcgakgfgf
Jang-Vijay Singh
August 30, 2016


Nice post. I used a slightly different approach (effectively treating SCA-INF as a sub-module by adding a tiny pom there) 

Also, there is a workaround for Java embedded activities as well - got the hint from a support note linked on my post. 

See this for both:



Enter your first name. It will only be used to display with your comment.
Enter your email. This will be used to validate you as a real user but will NOT be displayed with the comment.
By submitting this form, you accept the Mollom privacy policy.