Showing posts with label JMS. Show all posts
Showing posts with label JMS. Show all posts

Sunday, September 15, 2013

Working With Weblogic JMS Bridge

Weblogic messaging bride is a type of forwarding mechanism for JMS messages which can be used to transfer messages between two different domains of weblogic server. Basically the bridge has a Source Destination and a Target Destination which used along with JMS adapter helps to send the messages from one place to other. In this blog post have captured some of the configuration steps for JMS bridge to work:

1. Create a persistent store 
In Admin console; Click Lock and Edit and Under Persistent Stores ; Select New ; Create  FileStore
Name the store and target it to a specific server and finally activate the changes.









2. Create a JMS Server
In Admin console ; Click Lock and Edit and Under JMS Servers ; Select New
Set a name and select the corresponding FileStore and set the target to a specific server and after finishing, finally activate the changes

3. Create JMS Module
In Admin console ; Click Lock and Edit and Under JMS Servers  ; Select New
Click Next and Target it to the Servers and again click next. In the below page select the Check Box and click finish.







Click on the JMSModule and navigate to the Subdeployments page and click on New. Select a name and also target it to the JMS servers created earlier.

4. Create Connection Factory













Provide Name and JNDI name leaving rest fields as default and in next page click on Advanced targeting and select the subdeployment created earlier












5. Create Queue
Next create a Distributed JMS queue providing name and JNDI and under Advanced targeting, select the subdeployment created. Once finished activate the changes.











6. Create JMS Bridge Destinations
First create the source bridge destination.
In Admin console ; Click Lock and Edit and Under JMS Bridge Destinations ; Select New 
Provide the below details:
Connection URL: t3://source hostname:port/
Connection Factory JNDI Name: 
Destination JNDI Name: 

Click on OK and then click on source bridge destination name and ensure that the Weblogic credentials are correctly set there. This would be source server/domain credentials from where messages will be read.

Similar fashion create a target bridge destination and provide corresponding details.

NOTE: If weblogic is installed on a clustered server, the Connection URL format will be:
t3://node1 hostname:port,node2 hostname:port

Once done activate changes.

7. Create JMS Bridge
In Admin console ;Click Lock & Edit and Under Bridges ; Select New.
Provide name, select the corresponding source and target JMS destinations and finally click on Finish.

If all configuration is correct, we should see the below status for the JMS bridge under Monitoring tab.









NOTE :
For the XA Adapter to work the following file has to be deployed to Weblogic with name
jms-xa-adp  from /MW_Home/wlserver_10. 3/server/lib/jms-xa-adp.rar
Else the JMS bridge may give an error  "WARN: Failed to find the source/target adapter "

Apart from the JMS bridge configuration, need to create the corresponding JNDI name under deployments which will be used at runtime and this should be have the correct Connection factory(created in step4) configured in it.

The same JNDI name configured above will be used at design time while configuring the JMS adapter in Jdeveloper. Also the target destination name (JMS queue created in step5) will be configured in JMS adapter.

Tuesday, April 9, 2013

SOA 11g: Managed server error "weblogic.messaging.kernel.KernelException"

Recently came across an issue where the Managed servers were failing with below error. Even though servers start and come to running mode, but the JMS queues are not showing up in admin console under JMS Servers->Monitoring -> Active Destinations


<Error> <JMS> <BEA-040123> <Failed to start JMS Server "JMS_DEV_SERVER1" due to weblogic.jms.common.JMSException: weblogic.messaging.kernel.KernelException: Ignoring 2PC record for sequence=4706 queue=57 because the element cannot be found.
weblogic.jms.common.JMSException: weblogic.messaging.kernel.KernelException: Ignoring 2PC record for sequence=4706 queue=57 because the element cannot be found
        at weblogic.jms.backend.BackEnd.open(BackEnd.java:1008)
        at weblogic.jms.deployer.BEAdminHandler.activate(BEAdminHandler.java:200)
        at weblogic.management.utils.GenericManagedService.activateDeployment(GenericManagedService.java:239)
        at weblogic.management.utils.GenericServiceManager.activateDeployment(GenericServiceManager.java:131)
        at weblogic.management.internal.DeploymentHandlerHome.invokeHandlers(DeploymentHandlerHome.java:632)
        Truncated. see log file for complete stacktrace

This issue was after effect of the JMS file persistence store hitting 100% space utilization. As a result of which it got corrupted and was causing the JMS servers to fail while starting/activating.

To workaround this error, go to the Persistence File Store location (local/Shared SAN storage) and rename the existing *.DAT files to _bkp (say). Then go ahead and restart the managed servers. Now servers should come up fine without any issues/errors.

Oracle Metalink Note 1473826.1 "FileStore getting corrupted and WLS is unable to initialize JMS leading to BEA-040123 " suggests applying a Weblogic patch for Bug13900234. I haven't tried applying this patch but if issue persists inspite of workaround you can try this option as well.

Sunday, May 15, 2011

JMS Messages lost after server restart

Recently I came across an issue where JMS messages(unread) were lost from the queue when Weblogic server was restarted. This was kind of strange because Weblogic JMS provides a pretty stable solution around message delivery. Did some more analysis around this and below are the findings.

Weblogic JMS supports message retention in form of both Oracle AQ or an out-of-the-box DB persistence (file based persistence is default). In either case it should not lose message. The messages can be removed from the queues ONLY if:
a.      They are consumed by some process.
b.      If the messages gets expired, the queue handler will remove them
c.      If the delivery mode of messages coming from JMS Provider is Non-Persistent.

Which brings to the question of "What is JMSDeliveryMode ?" JMSDeliveryMode specifies PERSISTENT or NON_PERSISTENT messaging.
  • When a persistent message is sent, WebLogic JMS stores it in the JMS file or JDBC Store (database).
  • WebLogic JMS does not store non-persistent messages in the JMS database (prefix_wlstore). These messages are guaranteed to be delivered at least once unless there is a system failure, in which case messages may be lost.
You can check the JMSDeliverMode on incoming messages by looking at the JMS Header section.

<mes:WLJMSMessage xmlns:mes="http://www.bea.com/WLS/JMS/Message">
<mes:Header>
<mes:JMSMessageID>ID:xxxxxxx</mes:JMSMessageID>
<mes:JMSDeliveryMode>NON_PERSISTENT</mes:JMSDeliveryMode>
<mes:JMSExpiration>0</mes:JMSExpiration>
<mes:JMSPriority>4</mes:JMSPriority>
<mes:JMSRedelivered>false</mes:JMSRedelivered>
..
..
</mes:Header>
The JMS Provider should set this JMS Delivery Persistence to PERSISTENT mode and send it to consumer (JMS Queues in Fusion). No additional configuration is needed on Fusion– BY DEFAULT. Incase the messages are still being sent as NON-PERSISTENT then Weblogic provides a property for the Queue called "Delivery Mode Override" which can be used to override the delivery mode of incoming messages.