Join wMUsers | Blog at wMUsers | User Control Panel | Site Map | webMethods Jobs |For Employers

Mark Carlson -- webMethods Ezine Columnist

Invoking EJBs in JBoss 3 using webMethods 6



By Mark Carlson

 


Introduction

webMethods recently annoucned that it will integrate the JBoss application server directly into the webMethods integration platform in a future release. The stated purpose of this major move is to allow users to "exploit the strength of the J2EE-based development paradigm to complement their integration logic".

A few of the practical benefits of embedding JBoss into webMethods Integration Server (IS) include:

  1. Reduce the cost to provide EJB-based business logic to your integrations
    Because properly-designed EJB’s can be deployed in any J2EE-compliant container, you can deploy existing EJB’s running in expensive app servers elsewhere in your enterprise to JBoss to support your integrations.

  2. Use EJB’s to do the "heavy lifting"
    If your B2B or EAI integrations require more complex business logic than you want to implement as IS Java or Flow services, you can implement the complex logic in one or more EJB’s that can be used in your integrations as well as deployed to other app servers to be used elsewhere in the company.

  3. Increased performance
    By collocating the EJB’s that your webMethods IS integrations need inside the embedded JBoss app server you can eliminate the performance hit of additional serialization and a trip across the network to your company’s existing app server.

  4. Expose EJB’s as Enterprise Web Services
    While the EJB 2.1 spec (now available in public draft) will provide support for exposing EJB’s as web services when finalized, tight integration between IS and JBoss already makes doing so extremely easy for users of webMethods IS 4.6 and later. We’ll prove this in our example.

The integrated version of webMethods 6 is supposed to be generally available around mid-year 2003 either as an add-on to version 6 or as part of a future release. However, you don’t have to wait until then to realize many of the benefits of the embedded solution.

The purpose of this article is to provide step-by-step instructions on how to integrate webMethods 6 with JBoss 3.x using version 1.2 of the Integration Server’s EJB Adapter so that you can begin learning about how to access EJB’s deployed in the JBoss EJB container from your IS flow services.

Specifically, I’ll provide steps and screenshots to help you do the following:

  • Download and install the current binary version of JBoss 3.04 bundled with Tomcat 4.1.12

  • Install and configure version 1.2 of the IS EJB Adapter (note previous EJB Adapter versions do not support JBoss)
  • Deploy and test an example EJB onto the JBoss server

  • Use the EJB Adapter’s admin pages to locate the example and to generate a flow service that will invoke one of its public methods, addInts().

  • Use Developer to test the generated service

  • Use the new Web Services Browser to expose the EJB as a web service (hint: there’s nothing you have to do to make this happen)


What You’ll Need Before Starting

  1. An installed and functioning version of webMethods Integration Server 4.6 or webMethods 6. Note: The EJB Adapter will run on IS versions 3.6 and later, but the web services functionality that we’ll explore is not available prior to the IS 4.6 release with Service Pack 1.

  2. The wmUsersEJB.jar file that accompanies this article.

  3. The most recent download of the JBoss / Tomcat bundle from the JBoss downloads page

  4. Version 1.2 of the webMethods EJB Adapter. You may need a designated contact in your company to download this from the Advantage Web site for you.

  5. An installed and functioning Java JDK with the JAVA_HOME environment variable pointed to its installation directory. I used Sun’s 1.3.1 JDK version on Windows 2000 and set my JAVA_HOME environment variable to c:/jdk1.3.1_06


How to Install JBoss 3.04

First, unzip the JBoss / Tomcat bundle to the desired installation directory. I usually choose the root directory of my second hard drive, but you can use any valid path. Be sure to choose the "use folder names" option to preserve the path names during the unzip.

Next, rename the top level JBoss folder to something simpler than JBoss-3.0.4_Tomcat-4.1.12 (I renamed mine JBoss3) and copy the contents of the jboss_home\server\minimal to jboss_home\server\your_config_name. This creates a duplicate JBoss configuration in which you can experiment without messing up the default configuration.

To increase the amount of built-in applications that load with your server, choose the default folder instead of the minimal folder.

The JBoss directory structure should resemble the following:

JBoss Directory Structure

Next, create a NT batch file named "runJBoss.cmd" and start the JBoss Server by executing it. The batch file commands are listed below. Be sure to specify the proper directory structure.

    D:\
    CD d:\jboss3\bin
    start "Mark's JBoss Config" run.bat -c your_config_name

Once executed, the batch file will generate several screens full of INFO and WARN-level messages, but no ERROR messages. The last message will resemble this one and indicates success:

    "[Server] JBoss (MX MicroKernel) [3.0.4 Date:200211021607]
    Started in 0m:9s:524ms"

Download the accompanying code for this article and copy /pub/wmUsersEJB.jar to your JBoss /deploy directory. This will automatically deploy the EJB. To uninstall it, just delete the wmUsersEJB.jar from the folder. To deploy a new version, just paste a new version over the old one. It’s that simple!

To confirm that the EJB was successfully deployed, view the JBoss console log. The messages should be similar to these:

    19:04:42,860 INFO  [MainDeployer] Starting deployment of
    package: file:/D:/jboss3/server/mark/deploy/wmUsersEJB.jar
    19:04:42,980 INFO  [EjbModule] Creating
    19:04:42,990 INFO  [EjbModule] Deploying wmUsers
    19:04:43,010 INFO  [EjbModule] Created
    19:04:43,010 INFO  [EjbModule] Starting
    19:04:43,020 INFO  [EjbModule] Started
    19:04:43,020 INFO  [MainDeployer] Deployed package:
    file:/D:/jboss3/server/mark/deploy/wmUsersEJB.jar

Because the webMethods EJB Adapter requires a local copy of the jar, remember to copy wmUsersEJB.jar to the webMethods JAR directory. For webMethods Integration Server v4.6, this folder is install_dir\lib\jars directory; for webMethods 6, it is install_dir\lib\system.



[1]  2  Next>>

Go Deeper on the Subject: The wMUsers Discussion Forums


Mark Carlson is the president and principal solutions architect of Conneva, Inc. which specializes in the design and development of webMethods-based integration architectures. Mark has over 18 years of experience in the IT industry and has worked with webMethods products for the past 3 years. Mark and his family live in Evergreen, Colorado at 8,000 feet above sea level.

Mark can be reached via email at


Advertise at wMUsers






  Home | Join wMUsers | Discussion Forums | Knowledge Center | Jobs | Shareware | User Groups | Links |
Contact Us | Terms of Service | Privacy Policy

wMUsers is an independent organization and is not sponsored in any manner by Software AG.


© All Rights Reserved, 2001-2008.