Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Transactions: How Distributed Are Yours?

Talk to your peers

Another discussion based on a weblogic.developer.interest.transaction posting this month. It's a newsgroup that always proves to be a good source of information for the world at large when it comes to transactional behavior (and a good source of inspiration for me when the article time of the month rolls around again).

This particular posting is a great illustration of how an apparently simple assumption can pitch you into the bowels of the infrastructure, if you're not carefully guided by the architecture you're building against, and the possibilities it offers. The original posting ran:

We have to use distributed transactions between an XADataSource configured at the Web tier level in Tomcat 4.1.27 and an XADataSource configured in WebLogic Server 8.1. As a proof of concept, I built a small servlet sample that uses the XADataSource in Tomcat and uses the transaction manager of WebLogic.

When enlisting the XAResource with the javax.transaction.Transaction object, I keep receiving the following exception:

javax.transaction.SystemException: Not implemented at
weblogic.corba.j2ee.transaction.TransactionManagerImpl.enlistResource
(TransactionManagerImpl.java:370)
at com.myco.jta.TestServlet.addSubscription(TestServlet.java:103)
at com.myco.jta.TestServlet.doGet(TestServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

We use XAPool from ObjectWeb as the XADataSource implementation. I'd like to know if we are using JTA properly and if we are missing a configuration of some sort at the WebLogic level.

On the face of it, what could be simpler: a distributed architecture, and we want distributed transactions so let's start coding... But these exceptions quickly put a stop to that, and give pause for thought... Let's think this through.

A first observation, at a high level (and at a tangent to the whole point of this article), is the implicit physical splitting of tiers in this posting. Okay, there may be very good reasons in this case why Tomcat is used for the JSP/servlet logic - maybe it's already in production and is being extended - but WebLogic has a perfectly good servlet/JSP capability. It is amazing how many people decide that the fact that Sun describes a Web tier and an EJB tier means that these tiers must be physically separate. Even people using WebLogic for both the Web tier and the EJB tier often decide that they should deploy different WebLogic instances for both. This is not necessarily the case. Calling between processes is costly and a source of complexity in development, configuration management, and production maintenance. Yes, you can make the tiers physically separate, but even if all the tiers are deployed in a single WebLogic instance they are no less logically distinct! Sorry about that rant, this is a subject that really gets my goat. Just be thankful that I fought the temptation to type the whole of this paragraph in bold caps!

That Really Gets My Goat!
So, Ommmmm... Calm, calm, calm... and back to the plot.

At the high level, transactions flow around our J2EE system quite transparently; you start them, make calls, commit them, and take it for granted that the transaction context flowed around with your calls, and the commit processing touched all the resources you ended up using. This sounds like magic, and - of course - like everything else in the world, it isn't. There is a rational explanation. To find it, you just need to look beneath the J2EE surface you're coding to. What happened under the covers is that every time you made a call, the runtime discovered a Transaction object associated with your thread. This discovery prompted the runtime to piggyback the data about the transaction with the request. The piggybacked transaction information has, in turn, caused the infrastructure on the receiving end to do the "right thing" in terms of associating a transaction with its thread of control, and piggybacked data about the resources that got touched to make sure all the bits of transaction know about each other, so when the time comes the transaction co-ordinator can wander by, tell all the resources (which it has collected a list of) to commit, and life is good. All this apparent magic is wonderful, but it does imply a pretty close coupling between the application server's runtime infrastructure and the transaction manager, and this implication is not for nothing - the two are pretty inextricably tied together. So when you start talking about the scenario laid out in the newsgroup, where two different infrastructure implementations are involved, things are going to get a bit hairy if you carry on trying to make the simple assumption that transactions will flow between the containers and "just work" when it comes to commit time.

What it boils down to is that BEA WebLogic cannot make any assumptions about the nature of a client that is calling it but, as I discussed way back in November 2002 (WLDJ, Vol. 1, issue 11), it tries to smooth over the cracks by allowing a client to demarcate transactions whose completion will be delegated to a server-side transaction manager. A Tomcat client is no exception to that; as far as WebLogic is concerned, it is every bit as incapable as an applet.

What's Needed Is a Peer Relationship
What's needed to flow transactions between implementations in the way that the original poster wanted is a peer relationship between them, not a client/server one. If the two containers can be confident that each can look after itself in terms of transaction logging and recovery, then all that is needed is a shared understanding of how the transactions in one environment map on to those in the other. One way of doing this is via RMI/IIOP. If the containers are both speaking that protocol (as they are mandated to be able to do by J2EE 1.3) then the CORBA OTS specification provides a standard mechanism and interfaces for the transactions to flow through. Each container can handle its own internal implementation, with OTS providing a gateway between them. Internally to WebLogic, this gateway is implemented via a concept called an "Interposed Transaction Manager" - if WebLogic needs to import a transaction via OTS, that actually entails listening for "prepare", "commit", and "rollback" instructions from the remote system and responding appropriately to them. The BEA WebLogic transaction manager simply sits between these instructions and the actual resources participating in the transaction on the WebLogic side - it is interposed between the TM that controls the transaction and the local resources that it manages. If you think about it, responding to begin/prepare/commit/abort commands is exactly what any resource manager does through the xa interface. Wouldn't it be a neat trick if an xa interface could be exposed to WebLogic's transaction manager; then any foreign transaction manager could propagate transactions into WebLogic via xa, as if it were a database or any other xa resource, irrespective of support for any given network protocol.

The good news is that WebLogic's transaction manager offers just such a capability via the getServerInterposedTransactionManager and getClientInterposedTransactionManager methods provided by the weblogic.transaction.TxHelper. These methods give you the ability to get pretty exotic with the propagation of transactions into and out of WebLogic, to help you stitch together the end-to-end propagation of transactions.

As for the bad news... Well, until Tomcat grows a transaction manager of its own as a peer to WebLogic's, the scenario we started from just isn't going to work. Not that that's necessarily a bad thing - client code demarcating transactions can get some transaction architects foaming at the mouth and ranting, but that's a story for another month!

More Stories By Peter Holditch

Peter Holditch is a senior presales engineer in the UK for Azul Systems. Prior to joining Azul he spent nine years at BEA systems, going from being one of their first Professional Services consultants in Europe and finishing up as a principal presales engineer. He has an R&D background (originally having worked on BEA's Tuxedo product) and his technical interests are in high-throughput transaction systems. "Of the pitch" Peter likes to brew beer, build furniture, and undertake other ludicrously ambitious projects - but (generally) not all at the same time!

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
SYS-CON Events announced today that Daiya Industry will exhibit at the Japanese Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ruby Development Inc. builds new services in short period of time and provides a continuous support of those services based on Ruby on Rails. For more information, please visit https://github.com/RubyDevInc.
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
As businesses evolve, they need technology that is simple to help them succeed today and flexible enough to help them build for tomorrow. Chrome is fit for the workplace of the future — providing a secure, consistent user experience across a range of devices that can be used anywhere. In her session at 21st Cloud Expo, Vidya Nagarajan, a Senior Product Manager at Google, will take a look at various options as to how ChromeOS can be leveraged to interact with people on the devices, and formats th...
SYS-CON Events announced today that Taica will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Taica manufacturers Alpha-GEL brand silicone components and materials, which maintain outstanding performance over a wide temperature range -40C to +200C. For more information, visit http://www.taica.co.jp/english/.
SYS-CON Events announced today that SourceForge has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. SourceForge is the largest, most trusted destination for Open Source Software development, collaboration, discovery and download on the web serving over 32 million viewers, 150 million downloads and over 460,000 active development projects each and every month.
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities – ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups. As a result, many firms employ new business models that place enormous impor...
SYS-CON Events announced today that TidalScale will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale is the leading provider of Software-Defined Servers that bring flexibility to modern data centers by right-sizing servers on the fly to fit any data set or workload. TidalScale’s award-winning inverse hypervisor technology combines multiple commodity servers (including their ass...
As popularity of the smart home is growing and continues to go mainstream, technological factors play a greater role. The IoT protocol houses the interoperability battery consumption, security, and configuration of a smart home device, and it can be difficult for companies to choose the right kind for their product. For both DIY and professionally installed smart homes, developers need to consider each of these elements for their product to be successful in the market and current smart homes.
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, will lead you through the exciting evolution of the cloud. He'll look at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering ...
As hybrid cloud becomes the de-facto standard mode of operation for most enterprises, new challenges arise on how to efficiently and economically share data across environments. In his session at 21st Cloud Expo, Dr. Allon Cohen, VP of Product at Elastifile, will explore new techniques and best practices that help enterprise IT benefit from the advantages of hybrid cloud environments by enabling data availability for both legacy enterprise and cloud-native mission critical applications. By rev...
SYS-CON Events announced today that NetApp has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp emp...
SYS-CON Events announced today that Dasher Technologies will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Dasher Technologies, Inc. ® is a premier IT solution provider that delivers expert technical resources along with trusted account executives to architect and deliver complete IT solutions and services to help our clients execute their goals, plans and objectives. Since 1999, we'v...
SYS-CON Events announced today that TidalScale, a leading provider of systems and services, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale has been involved in shaping the computing landscape. They've designed, developed and deployed some of the most important and successful systems and services in the history of the computing industry - internet, Ethernet, operating s...
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
Amazon is pursuing new markets and disrupting industries at an incredible pace. Almost every industry seems to be in its crosshairs. Companies and industries that once thought they were safe are now worried about being “Amazoned.”. The new watch word should be “Be afraid. Be very afraid.” In his session 21st Cloud Expo, Chris Kocher, a co-founder of Grey Heron, will address questions such as: What new areas is Amazon disrupting? How are they doing this? Where are they likely to go? What are th...