JOnAS Integration

The Bull R&D team in charge of JOnAS development is pleased to announce the Service Mix integration in the lastest JOnAS stable release (jonas4.6.6-tomcat5.5.12.tgz). This version is the latest J2EE 1.4 certfied release.

The Service Mix version needed for this integration must be one up to servicemix-3.0-M1.

Thanks to Guillaume Nodet for the overnigth fix on the standard jms processor !

Installation

In order to deploy the ServiceMix web application into the JOnAS server, follow the next configuration steps.

First of all, download the latest ServiceMix version (servicemix-3.0-M1) or SNAPSHOT released after the 2006-04-07. Then you can extract it in a directory of your choice to be able to update configuration files.

ServiceMix web application configuration :

  • configure JORAM jms provider instead of activeMQ in the web app WEB-INF/applicationContext.xml
    <bean id="jmsFactory"
    	class="org.objectweb.joram.client.jms.local.LocalConnectionFactory">
    </bean>
    
  • remove references to activeMQ in the web app WEB-INF/
    <context-param>
    	<param-name>contextConfigLocation</param-name>
    	<param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    
    instead of
    <context-param>
    	<param-name>contextConfigLocation</param-name>
    	<param-value>/WEB-INF/applicationContext.xml WEB-INF/activeMQ.xml</param-value>
    </context-param>
    
  •  remove references to activeMQ in the web app WEB-INF/applicationContext.xml

You can take the following code these files :
 

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0"
	xmlns:sm="http://servicemix.apache.org/config/1.0"
	xmlns:my="http://servicemix.apache.org/demo/"
	xmlns:foo="http://servicemix.apache.org/demo/">

	<!-- the JBI container -->
	<sm:container id="jbi" rootDir="<at:var at:name="rootDir" />"
		useMBeanServer="true" createMBeanServer="true"
		installationDirPath="<at:var at:name="installationDirPath" />"
		deploymentDirPath="<at:var at:name="deploymentDirPath" />"
		monitorInstallationDirectory="true" dumpStats="true"
		statsInterval="10" transactionManager="#transactionManager">

	</sm:container>

	<bean id="transactionManager"
		class="org.jencks.factory.TransactionManagerFactoryBean" />


	<bean id="jmsFactory"
		class="org.objectweb.joram.client.jms.local.LocalConnectionFactory">
	</bean>

</beans>

web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

  <display-name>ServiceMix Web Application</display-name>
  <description>Deploys ServiceMix inside a Web Application</description>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
  </context-param>
  <context-param>
    <param-name>contextClass</param-name>
    <param-value>org.apache.xbean.spring.context.XmlWebApplicationContext</param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  <!-- servlet mappings -->

  <!-- the main JMX servlet -->
  <servlet>
    <servlet-name>JMXServlet</servlet-name>
    <servlet-class>org.apache.servicemix.web.jmx.JMXServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>


  <servlet-mapping>
    <servlet-name>JMXServlet</servlet-name>
    <url-pattern>/jmx/*</url-pattern>
  </servlet-mapping>

</web-app>

Warning : ServiceMix is delivering the web application with a set of jar files which is not enough to use all components. You can add any required jar into the WEB-INF/lib directory of the web application.
You can find a lot of used jars in ServiceMix standalone lib directory.

Once you have generated the new web application, you can deploy it into your JOnAS server and then install any components and deploy any service assemblies you want !

Example

Here is an example running into ServiceMix deployed as a web application into JOnAS application server.

This example called ServiceMixOnJOnASExample1 is using three different components:

  1. servicemix-http (Binding Component)
  2. drools (Service Engine)
  3. servicemix-jms (Binding Component)

The client sends a SOAP message with an attachment over http to servicemix-http
which post it to the NMR. Then the message is forwarded to the drools component. If the SOAP body of the sent message contains the keyword 'keep', then the message is posted to the NMR without any modification. Else, the attachment is remove from the message. Then the message is routed to the servicemix-jms component which transforms it into a JMS Message sent to the ServiceMixOnJOnASExample1Queue queue. The client (which was waiting on this queue) received the message.

Here is a schema of the flow :

 
You can download an archive containing all the example ; ServiceMixOnJOnASExample1

Limitations

ServiceMix clustering is using ActiveMQ classes so this functionnality is not supported in JOnAS which is using JORAM.

JORAM could not be configured through spring xm files, so servicemix lightweight jms component could not be used. 

  • No labels