1. Introduction


2. Brief descripions of ServiceMix, GlassFish and Java EE Service Engine


3. Installing ServiceMix on GlassFish


4. Installing Java EE Service Engine to ServiceMix


5. Accessing the EJBs deployed on GlassFish from ServiceMix using Java EE Service Engine


6. More Info.





            This blog details the experiments I did recently to make ServiceMix run inside GlassFish application server.
            The other interesting thing about this integration is the ability of the GlassFish application server to allow the in-process communication between ServiceMix and Java EE components (EJBs/Servlets wrapped as webservices) using a readily available JBI component of GlassFish viz., the Java EE Service Engine.
            Details of the versions of the various softwares I used for this experiment :
GlassFish Application Serverv2 b31


 Brief descriptions of ServiceMix, GlassFish and Java EE Service Engine

ServiceMix is an open source distributed Enterprise Service Bus (ESB) and SOA toolkit built on the semantics and APIs of the Java Business Integration (JBI) specification JSR 208 and released under the Apache license. More details about the ServiceMix is found at


GlassFish is free and open source Java EE 5 application server. It is based on the source code for Sun Java System Application Server donated by Sun Microsystems. More details about the GlassFish is found at


Java EE Service Engine acts as a bridge between GlassFish and JBI environment for web service providers and web service consumers deployed in GlassFish. It provides numerous benefits including the following :

  • EJBs/Servlets packaged as web services and deployed on GlassFish are transparently exposed as service providers in JBI Enviroment
  • Java EE Components - EJBs/Servlets can consume services exposed in JBI enviroment using the Java EE service engine without being aware of the underlying binding/protocol such as SOAP, JMS etc exposing the web service.
  • In-process communication between components of application server and JBI components to increase request processing speed.
  • Any component that is plugged into ESB can directly communicate with Java EE applications. For example, clients of various bindings such as SOAP or JMS can communicate with web services developed using Java EE via JBI because of Java EE Service Engine.
            The default JBI runtime bundled with GlassFish is OpenESB which is an open source, world-class enterprise service bus based on JBI technology. The details of OpenESB is found at
            This article is for those who want to use ServiceMix as their JBI runtime with GlassFish application server. So the article explains how to install ServiceMix on GlassFish and how the ServiceMix can use Java EE Service Engine to do in-process communication with the Java EE applications (web services) deployed on GlassFish.



 Installing ServiceMix on GlassFish

Download, install and start the latest GlassFish (if you haven't done already) from here. From now on, I will refer $glassfish_dir to GlassFish installation directory.


Download either the source or binary distribution of ServiceMix from here. Now we need to create ServiceMix WAR file inorder to install ServiceMix on GlassFish. From now on, I will refer $servicemix_web_dir to your servicemix-web directory which will be either examples/servicemix-web (for binary distribution) or samples/servicemix-web (for source distribution).


Create ServiceMix WAR file :

cd $servicemix_web_dir

# Do this workaround in pom.xml :
<scope>test</scope> (line 82) (Ref : Mailing List Archive )

# Change servicemix-http configuration to accept dynamic SU deployments. In $servicemix_web_dir/src/webapp/WEB-INF/applicationContext.xml, change <http:component>....</http:component> to <bean class="org.apache.servicemix.http.HttpComponent" /> (Ref : Mailing List Archive ) # creates target/servicemix-web-3.0-incubating.war
mvn install -Dmaven.test.skip=true
# Rename the WAR file as servicemix-web.war for simplicity. mv target/servicemix-web-3.0-incubating.war target/servicemix-web.war

Deploy ServiceMix WAR file to GlassFish :

$glassfish_dir/bin/asadmin deploy --port 4848 $servicemix_web_dir/target/servicemix-web.war 
 Installing Java EE Service Engine to ServiceMix

The servicemix components (I am refering to servicemix-http which is what is used in the sample application) do not wrap/unwrap the WSDL1.1 defined messages as explained in of JBI 1.0 specification. This seems like a bug with the servicemix components. So, to workaround this and make Java EE Service Engine inter-operate with servicemix components, we need to set system property.


Here are the steps :

# Add the following JVM option in $glassfish_dir/domains/domain/config/domain.xml and Restart GlassFish


Drop the Java EE Service Engine JAR file and the required shared libraries to autodeploy directory of ServiceMix cd $glassfish_dir/domains/domain1/applications/j2ee-modules/servicemix-web/deploy
cp $glassfish_dir/jbi/sharedlibraries/wsdl/installer/wsdlsl.jar .
cp $glassfish_dir/jbi/components/javaeeserviceengine/installer/appserv-jbise.jar .

 Accessing the EJBs deployed on GlassFish from ServiceMix using Java EE Service Engine

A sample application demonstrates how to access EJB webservice deployed on GlassFish application server from ServiceMix using Java EE Service Engine.


This is the schema of flow of the sample.




The source code of this sample is available in GlassFish workspace under appserv-tests/devtests/webservice/jbi-serviceengine/sm/bc_consumer_se_provider
            The sample has all the necessary ant tasks predefined. All that is needed is to run $glassfish_dir/bin/asant command.


Here are the steps to checkout the GlassFish source code and run the sample :

# Checkout GlassFish

cvs -d checkout glassfish

# Run the sample

cd glassfish/appserv-tests/devtests/webservice/jbi-serviceengine/sm/bc_consumer_se_provider $glassfish_dir/bin/asant


 More Info

Java EE Service Engine