ejb2 egress connector

EJB2 Egress Connector

Version: 17.07

Supported Since: 17.07

What is an EJB2 Egress Connector?

The EJB2 Egress Connector allows you to use Enterprise Java Beans with the UltraESB-X.

In order to use the EJB2 Egress Connector, you must first select the EJB2 Connector dependency from the connector list when you are creating an empty Ultra project. If you have already created a project, you can add the EJB2 Connector dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list, select the EJB2 Connector dependency.
ejb2 egress connector ports

Out Ports

Response Processor

The message will be sent to this out port if the specified method in the java bean invoked successfully.

On Exception

The message will be sent to this out port if the Egress Connector failed to process the message due to some reason

Side Ports

Connector Operation

This port is used to connect operational elements to the Egress Connector. By-default, user does not have to connect any operational element and the default connector operation will be used.


* marked fields are mandatory

Initial Context Factory (java.naming.factory.initial) *


The name of the environment property for specifying the initial context factory to use. The value of the property should be the fully qualified class name of the factory class that will create an initial context. If it is not specified, a javax.naming.NoInitialContextException will be thrown when an InitialContext object is created.

URL Package Prefixes (java.naming.factory.url.pkgs)


The name of the environment property for specifying the list of package prefixes to use when loading in URL context factories

Tuning parameters


Other Parameters specific to the application server used

Full Qualified Name of the Bean Interface *


Full Qualified Name of the Bean Interface

  • Eg: com.acme.library.LibrarySessionBeanRemote

JNDI Name *


JNDI Name for bean lookup. This will vary according to the application server used.

Method Name *


The name of the method in the java bean to be invoked.

Choose how to extract respective parameters *


This will determine how the values are extracted for the parameters respective to the method invoking.

Sample Use Case


You need to have an application server (JBoss, GlassFish, Oracle WebLogic, etc..) up and running. Moreover you need an EJB module which includes the implementation of your Enterprise Java Bean along with it’s client application which has been deployed in the application server. Build the client application and retrieve a jar file.

1. Invoking a Method in the EJB

First, let’s create our integration flow for this example. Add a NIO HTTP Ingress Connector which listens on port 8280 and service path /service/echo-proxy for HTTP POST requests. We use this to inject messages into UltraESB-X engine.

After that, let’s add an Add Variable Processor to the flow and include the parameter value to be extracted as a variable.

Egress Config
Figure 1: Egress Config

After that, we’ll add an EJB2 EgressConnector to invoke the method specified. When configuring the EJB2 EgressConnector, you need to set the properties according to the application server you have used to deploy the Bean. For an example consider following property sets,

GlassFish Sever

  • java.naming.factory.initial = com.sun.enterprise.naming.SerialInitContextFactory

  • java.naming.factory.url.pkgs = com.sun.enterprise.naming

  • Other properties:

    • org.omg.CORBA.ORBInitialHost = localhost

    • org.omg.CORBA.ORBInitialPort = 3700

JBoss Server

  • java.naming.factory.initial = org.jnp.interfaces.NamingContextFactory

  • java.naming.factory.url.pkgs = org.jboss.naming:org.jnp.interfaces

  • Other properties:

    • java.naming.provider.url = jnp://localhost:1099

Add your client jar to UltraESB-X/lib/custom folder in UltraESB-X. You need to specify the classpath name for your bean interface as com.acme.library.LibrarySessionBeanRemote.

Specify the JNDI name of your EJB according to the application sever you are running. For example,

GlassFish Sever


JBoss Server


After specifying the method name to be invoked and how the parameters are extracted, the configuration phase of EJB2 EgressConnector is finished. To retrieve the response from the invoked method we are using a NIO HTTP Egress Connector which listens to 9000 port.

If your application server is GlassFish, then you have to add the following dependency to your POM to successfully run the project on UltraESB-X,


If you are using a JBoss Server as your application server, then you have to add the jars in your <JBoss_location>/client to UltraESB-X/lib/custom.

After adding all these elements, final flow would be like this,

Complete flow
Figure 2: Complete flow

Now it’s the time to send a HTTPS Request and test our flow. Open the HTTP/S client Tool Window and set a sample request payload in the text box located in the left.

In this topic
In this topic
Contact Us