X

Proactive insights, news and tips from Oracle WebLogic Server Support. Learn Oracle from Oracle.

  • September 10, 2009

Message Driven Bean Migration from OC4J to WebLogic

Both OC4J

and WebLogic have a provider specific descriptor

that, in conjunction with the standard ejb-jar.xml descriptor,

integrates MDBs

with the container and provides inbound configuration that identifies

the

source destination and related information.  This source

destination may share the same instance as the MDB, be from a different

instance, or even a different JMS provider.    This

discussion will focus on the configuration approaches of OC4J and

WebLogic and offer what needs to be considered when migrating an

existing MDB deployed to OC4J to a WebLogic server.

OC4J and WebLogic MDB Configuration Approaches



Each OC4J JMS MDB endpoint is associated with a set of configuration

properties (referred to as ActivationSpec

properties).   

These properties are typically set in the
style="font-family: monospace;">orion-ejb-jar.xml, however,

the properties can also be set in the
style="font-family: monospace;">ejb-jar.xml file if the JMS

connector is included in an application's .ear file.   The

syntax for each file is different.





<orion-ejb-jar>


    <enterprise-beans>


       <message-driven-deployment

name="simpleMdb" resource-adapter="tibcojms">


       

<config-property>


           

<config-property-name>ExamplePropertyName</config-property-name>


           

<config-property-value>ExampleValue</config-property-value>


        </config-property>


        ...





When using the

ejb-jar.xml file, the

properties are added to each

<message-driven> node, using the following syntax:





<ejb-jar>


    <enterprise-beans>


       <message-driven>


         

<ejb-name>simpleMdb</ejb-name>


         

<activation-config


       

<activation-config-property>


           

<activation-config-property-name>ExamplePropertyName


           

</activation-config-property-name>


           

<activation-config-property-value>ExampleValue


           

</activation-config-property-value>


       

</activation-config-property>


       ...





A complete listing of OC4J JMS ActivationSpec properties and their

usage can be found in
href="http://download.oracle.com/docs/cd/B32110_01/web.1013/b28958/jms.htm#CIHIGGHH">chapter

four of the OC4J Services Guide, fine tuning MDB endpoints.





For WebLogic, Message Driven Beans can be integrated into the server

through the use of the <message-driven-descriptor> stanza within

the weblogic-ejb-jar.xml

file.





<weblogic-ejb-jar>


  <weblogic-enterprise-bean>


    <ejb-name>SimpleMdb</ejb-name>



    <message-driven-descriptor>


      

<destination-jndi-name>...</destination-jndi-name>


      

<initial-context-factory>...</initial-context-factory>


      

<connection-factory-jndi-name>...</connection-factory-jndi-name>


      

<jms-client-id>...</jms-client-id>


      

<generate-unique-jms-client-id>...</generate-unique-jms-client-id>


      

<durable-subscription-deletion>...</durable-subscription-deletion>


       ...


    </message-driven-descriptor>



 

</weblogic-enterprise-bean>


</weblogic-ejb-jar>






A complete description for developing MDBs in WebLogic can be found in

the
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13719/message_beans.htm#EJBPG399">Design

Message-Driven Beans guide.
href="http://download.oracle.com/docs/cd/E12840_01/wls/docs103/ejb/DDreference-ejb-jar.html">

MDB Migration Considerations

Resource References



It's very common for MDB applications to leverage resource references

for forwarding/response purposes.  Like OC4J, WebLogic provides an

element in its proprietary weblogic-ejb-jar.xml

to map a logical

resource reference to a JNDI location.   This element is named

<resource-description>.  
class="046592623-09092009">
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13727/j2ee.htm#g1329180">Enhanced

Support for Using WebLogic JMS with EJBs and Servlets
style="color: rgb(0, 0, 0);">steps through its usage step-by-step and

also describes how WebLogic automatically wraps and pools resource

references.

href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13712/weblogic_xml.htm#i1087465">

XA Support




Both OC4J and WebLogic utilize the standard JEE
style="font-family: monospace;">ejb-jar.xml descriptor

to identify if the inbound MDB participates in an XA

transaction.  
<ejb-jar>
<enterprise-beans>
<message-driven>

style="font-weight: bold;"> <transaction-type>Container</transaction-type>

<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>...</ejb-name>
<method-name>onMessage()</method-name>
</method>

style="font-weight: bold;"><trans-attribute>Required</trans-attribute>



Users must then specify a JMS connection factory that implements the XA

for the inbound MDB and for any connection factories configured as

resource-references used within the MDB.

Translating OC4J JMS MDB ActivationSpec Properties



Migrating the MDB involves understanding which ActivationSpec

properties are defined for the MDB in OC4J, then utilize the WebLogic

MDB descriptor elements to configure similar behavior.  

Furthermore, any ActivationSpec properties defined within the standard

ejb-jar.xml descriptor

should either be commented out or

removed.   WebLogic will not process OC4J specific

activation-config-properties.





A listing of OC4J JMS MDB ActivationSpec properties and how they may be

translated to the descriptors for WebLogic's MDB implementation is a

follows:






cellspacing="2">






style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">OC4J

JMS MDB


ActivationSpec Property





style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Purpose





style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">How

to define

in WebLogic






















































































































ConnectionFactoryJndiName,


Destination Name,


DestinationType


MDB inbound configuration

including the JNDI names for the connection factory and destination and

the destination type.


The inbound JNDI names

for the MDB are configured as connection-factory-jndi-name

and destination-jndi-name elements

in the message-driven-subscription

section of weblogic-ejb-jar.xml.


The destination type is specified using the
style="font-style: italic;">destination-type element in

the message-driven section of

ejb-jar.xml.


SubscriptionDurability,


SubscriptionName


Identifies if an MDB's

topic subscription is durable or non-durable and the subscription name.


The subscription

durability is configured as subscription-durability

element in the message-driven

section of ejb-jar.xml.  Subscription name can not be specified in

WebLogic.


ClientIDIf set, connections used

by the inbound MDB connection will set this clientID
Set by the
style="font-style: italic;">jms-client-id element in the
style="font-style: italic;">message-driven section of
style="font-style: italic;">weblogic-ejb-jar.xml.  

Additionally,

style="font-size: 10pt; font-family: "Times New Roman";">a
style="font-style: italic;">generate-unique-jms-client-id element

in the same descriptor may be used in some cases.
AcknowledgeMode


Controls quality of

service for MDB's onMessage



style="font-size: 10pt; font-family: "Times New Roman";">Configured

as acknowledge-mode element

in the message-driven section

of the

ejb.jar.xml.
MessageSelector


Selector expression to

filter inbound messages



style="font-size: 10pt; font-family: "Times New Roman";">Configured

as message-selector element

in the message-driven section

of the

ejb-jar.xml.
UseExceptionQueue,


ExceptionQueueName,


IncludeBodiesInExceptionQueue


Specifies how to handle

problem messages (if they should be saved to an exception queue and in

what format)


WebLogic does not handle

problem messages on an MDB by MDB basis.   User needing such

features may consider configuring an error destination if the JMS

provider is WebLogic.


MaxDeliveryCntThe number of times an

MDB will attempt to process the same message before it is discarded.
WebLogic MDBs do not

supply this capability directly.


If the source destination is a WebLogic JMS destination, users can

configure a delivery limit in the JMS destination

configuration.    Also, if the source is a WebLogic JMS

destination you can configure redelivery delay.


MaxListenerThreads,


MinListenerThreads,


ReceiverThreads
Controls the maximum and

minimum number of receiver threads to create for the endpoint. 

(RecieverThreads was depricated in OC4J 10.1.3.4 in favor of

Min/MaxListenerThreads)
This

is configured by the max-beans-in-free-pool

and dispatch-policy element values in the
style="font-style: italic;">message-driven-descriptor
element

of weblogic-ejb-jar.xml.
ListenerThreadMaxPollInterval,


ListenerThreadMaxIdleDuration,


ListenerThreadMinBusyDuration


Controls the throttling

of the number of MDB threads, how fast should they ramp up or down

(works in conjunction with MaxListenerThreads and MinListenerThreads).



style="font-size: 10pt; font-family: "Times New Roman";">No action

required.  WebLogic MDB thread throttling

is either automatic or is

delegated to the source JMS server's built in asynchronous consumer

capability,

depending on the use case
EndpointFailureRetryInterval


If endpoint can not be

processed, how long until it will be scheduled to be retried

The init-suspend-seconds

element Allows

an MDB to suspend it's JMS connection when the EJB container detects a

JMS

resource outage.

The max-suspend-seconds

element provides the maximum number of

seconds to

suspend an MDB's JMS connection when the EJB container detects a JMS

resource

outage.



Additionally,

the jms-polling-interval-seconds element sets the number of

seconds between attempts by the

EJB container to

reconnect to a JMS destination that has become unavailable.
ResUser,


ResPassword


Allow a pre-defined

username/password to be specified for the MDB's JMS connection.


Users may utilize the JMS

Foreign Server (even for the local WebLogic JMS server) to specify

pre-defined username/passwords for the MDB's inbound connection.





href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13719/message_beans.htm#EJBPG454">Configuring

a Security Identity for a Message-Driven Bean is another approach

available in WebLogic.







When the Destination is Remote



When a destination is remote, both WebLogic and OC4J require

further configuration.







OC4J requires that remote destinations and connection

factories be configured as part of a JMS Connector. 

The JMS connector will use an OC4J resource-provider to access a

foreign server's context.  The connector

includes entries in oc4j-connectors.xml to map foreign destinations and

the

resource adapter's oc4j-ra.xml descriptor for mapping connection

factories.   OC4J utilizes the same

JMS

Connector approach when accessing JMS objects for the local OC4J

instance's JMS

server objects.







For WebLogic, remote destinations are preferably accessed via

Foreign Server Context, Foreign Connection Factory, and Foreign

Destination

mappings that are configured in a JMS configuration system module.
style="">





In WebLogic, a destination is known to be "local" to a

WebLogic MDB when the MDB and destination both run on the same server

or

cluster. In cases where the destination is deployed on a different

server or

cluster, it is referred to as a "remote" destination to the MDB.
style="">  





A remote destination also includes those defined in the Oracle AQ JMS

provider and non-Oracle JMS providers..   Integrating AQ JMS

with WebLogic 10.3.1 is discussed in
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13738/aq_jms.htm#JMSAD565">Interoperating

with Oracle AQ JMS.   Information for integrating AQ JMS

with earlier WebLogic releases can be found in
href="http://blogs.oracle.com/learnwithpavan/entry/aq_weblogic_jms_connectivity_u">AQ

- Weblogic JMS Connectivity using Weblogic JMS Bridge.  

Integrating WebLogic with non-Oracle providers is discussed in
href="http://download.oracle.com/docs/cd/E12839_01/web.1111/e13738/advance_config.htm#i1081815">Configuring

Foreign Server Resources to Access Third-Party JMS Providers







The nature of a destination--local versus remote--dictates to

some extent how the following key elements in the
style="font-size: 10pt; font-family: "Courier New";">message-destination-descriptor


for the MDB in
style="font-size: 10pt; font-family: "Courier New";">weblogic-ejb-jar.xml


are configured, as shown in the table below:






cellspacing="2">






















style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Not

using Foreign Server (not the preferred method)





style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Using

Foreign Server (preferred method)

























































style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">WebLogic

message-driven-description Attribute



style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Value



style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Destination

is Local



style="vertical-align: top; font-weight: bold; background-color: rgb(204, 204, 204);">Destination

is Remote


provider-url


Do not specify


Specify remote/foreign

provider-url


Do not specify

provider-url.  The URL is implicitly encoded in the Foreign Server

configuration.


initial-context-factory


Do not specify


Specify the initial

context factory class name used by the JMS provider except when the

remote provider is WebLogic JMS, in which case, do not specify this

value (use the default)


do not specify

initial-context-factory


destination-jndi-name


Specify the name bound in

the local JNDI tree for the destination


Specify the name of the

destination, as bound in the remote provider's JNDI tree


Specify the name of the

Foreign Destination you set up in your local JNDI tree that corresponds

to the remote or foreign destination.


connection-factory-jndi-name


Do not specify

connection-factory-jndi-name unless a custom connection factory is

configured to be used with the MDB.


Specify the name of the

connection fatory used by the JMS provider, as bound in the remote JNDI

tree, except when the remote provider is WebLogic JMS in which case it

is okay to use the default.


Specify the Foreign

Connection Factory you set up in your local JNDI tree that corresponds

to the remote JMS provider's connection factory.





For more information regarding WebLogic and MDB Integration













Join the discussion

Comments ( 13 )
  • Richard Parms Thursday, March 4, 2010
    Por favor, ¿puede PM y decirme cuantas más piensa en esto, estoy muy fan de tu blog Publica ...
  • Dary Hall Tuesday, April 27, 2010
    Well, I *have* to leave a comment in this thread.. Well put :)
  • piece akumulacyjne Tuesday, July 6, 2010
    Great site and nice text.
  • never fail list building system Monday, August 23, 2010
    Wonderful article which has received me considering concerning the possible of the idea. Definitely definitely awesome.
  • pornhub Monday, November 29, 2010
    Proverb Truth, the whole truth and nothing but the truth. is pornhub safe dog grooming supplies sick masters degree welcome celebrity 'new http://www.thepornhubx.com - porn hub Richard Whately The best security against revolution is in constant correction of abuses and the introduction of needed improvements. It is the neglect of timely repair that makes rebuilding necessary. Hermann Weyl Logic is the hygiene the mathematician practices to keep his ideas healthy and strong. video downloader pornhub
    gills virginia salt mountain blazers pornhub video downloader pornhub username and password damp prairiewith bike pornhub Daniel Walker The simplest way to stop a flamewar is to breathe deeply, swallow your bile and just LET an idiot have the last word. download pornhub Johan Cruijff If you score one more goal than the other team, you win.
  • Joyce Mcsparin Saturday, January 22, 2011
    Trusting to make the right decisions can be tough. It can take many people a long time to build a strong moral system. It doesn't really just happen if you know what I mean.
  • Luther Gongora Friday, February 4, 2011
    I am definately gonna subscribe, this is soo interesting, love your thoughts.
  • Buy Links Monday, February 28, 2011
    Dang i thought your blog was killer, gave me a car load of information, i never knew, thanks blogger.
  • Buy Backlinks Wednesday, March 2, 2011
    Great blog! You should start many more. I love all the info thanks I will stay tuned :)
  • AdheceJamma Thursday, March 3, 2011
    Hello. And Bye.
  • Issac Maez Saturday, March 12, 2011
    I must get across my passion for your generosity giving support to men who have the need for help on your subject matter. Your personal commitment to passing the message throughout became definitely invaluable and have usually encouraged guys and women much like me to reach their targets. Your interesting guide means a lot a person like me and especially to my fellow workers. Regards; from all of us.
  • Nigel Beerling Friday, April 15, 2011
    Hi there! I saw there is something wrong with your blog, i tried to bookmark, but it didn't happened anything. Can you please check and let me know when it's back again? Thank you! :)
  • Hollywood Bodies Friday, April 15, 2011
    Hi there! I saw there is something wrong with your feed, i tried to follow, but it didn't worked. Can you please check and let me know when it's on again? Thank you! :)
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.