WebSphere Application Server - [WAS6 / Spring / MDB] UserTransaction not not found?

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > March 2006 > [WAS6 / Spring / MDB] UserTransaction not not found?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [WAS6 / Spring / MDB] UserTransaction not not found?

2006-03-06, 5:55 pm

We've got an application running on JBoss 4.0.2 that we're currently porting to WebSphere 6. The application uses Spring and Hibernate, and is built with ant and xdoclet.

In porting the application we've run into a problem with JMS, as we get a javax.naming.NameNotFoundException for java:comp/UserTransaction (I understand this the "new home" for the UserTransaction object in WAS6 as opposed to the "old home" in WAS5, jta/u
sertransaction).

At this point, I don't know if the issue is in our code, in the Spring Framework, or in my configuration of WebSphere, but as I'm a complete WebSphere novice, I wouldn't be at all surprised if it is the latter!

To help illustrate my problem, I've created a dummy HelloMDB project and a step-by-step summary of what I do to configure WebSphere. Currently I'm experiencing three problems -

1) At deployment I get an ADMA8019E warning with my Activation Specification.
2) At deployment I get an ADMA0138W warning with my Activation Specification.
3) At run-time I get a javax.naming.NameNotFoundException for java:comp/UserTransaction

The HelloMDB project (with source, build and configuration scripts, spring and xdoclet libraries, and deployment descriptors) is available as a 4 MB zip file from http://www.mindbend.demon.co.uk/EchoMDB.zip (though you'll need to supply your own JDK1.4 an
d Ant installation). I'll be happy to post scripts and config files here, I just didn't want to clutter up the thread if there's an easy, obvious solution that I've missed!

I'm really at my wits' end on this one, and would greatly appreciate any and all hints or suggestions on this matter.

Thanks for your help,

=Per
Paul Ilechko

2006-03-06, 5:55 pm

per.hammer@vamosa.com wrote:
> We've got an application running on JBoss 4.0.2 that we're currently
> porting to WebSphere 6. The application uses Spring and Hibernate,
> and is built with ant and xdoclet.
>
> In porting the application we've run into a problem with JMS, as we
> get a javax.naming.NameNotFoundException for
> java:comp/UserTransaction (I understand this the "new home" for the
> UserTransaction object in WAS6 as opposed to the "old home" in WAS5,
> jta/usertransaction).
>


Not sure what the specifics of your problem are, but using user
transactions with MDBs is not a very good idea, as you can lose
messages. Ideally if you want guaranteed delivery you should be using
container managed transactions. By the time you start a user transaction
the message has already been read outside of that transaction. If your
transaction rolls back, the message has already been consumed, and is lost.

2006-03-06, 5:55 pm

You may find these links helpful. Please post a reply if you find the soultion.
o http://forum.springframework.org/showthread.php?t=20088
o http://www.springframework.org/docs...nsactionManager(javax.transaction.TransactionManager)
o http://www-128.ibm.com/developerwor...rown/brown.html

Cheers,
Trond Arve

2006-03-13, 5:56 pm

I figured it out.

We were using dentical (Spring) bean factory configuration files inside both the Servlet and EJB containers. The UserTransaction is found as expected in the Servlet container, but isn't available in the EJB container (presumably because we only have MDBs
defined).

I've now rewritten the EJB side bean factory configuration to remove the TransactionFactory wrapper around our beans, and it's working. (Though I had to upgrade to Hibernate3.2-alpha and Spring 1.2.7 in the process.)

I'm still left with ADMA8019E and ADMA0138W warnings at deployment relating to my Activation Specifications, though, but it seems to be working so I'll investigate those later.

Thanks to everyone for the help!

Cheers,

=Per
Randy Schnier

2006-03-13, 5:56 pm

Here's the most likely reason your MDB's java:comp/UserTransaction
lookup is failing:

As outlined in the JavaEE specs, the EJB container is only supposed to
make java:comp/UserTransaction available in the component-specific JNDI
namespace if the EJB has been configured for bean-managed transactions.
If the EJB is configured for container-managed transactions (the
default), java:comp/UserTransaction won't be available in that EJB's
namespace (again, per the JavaEE specs). Recall that there's an
individual java:comp namespace maintained by the container for each EJB
component being hosted by that container. The presence or absence of
java:comp/UserTransaction in that namespace isn't determined by bean
type (MDB vs. SLSB, etc.) but by transaction management type (CMT vs. BMT).

As Paul mentioned in a previous posting on this thread, configuring
message-driven beans for bean-managed transactions is not a good
practice since you can easily lose messages if the transaction is forced
to roll back.

per.hammer@vamosa.com wrote:
> I figured it out.
>
> We were using dentical (Spring) bean factory configuration files inside both the Servlet and EJB containers. The UserTransaction is found as expected in the Servlet container, but isn't available in the EJB container (presumably because we only have MDB

s defined).
>
> I've now rewritten the EJB side bean factory configuration to remove the TransactionFactory wrapper around our beans, and it's working. (Though I had to upgrade to Hibernate3.2-alpha and Spring 1.2.7 in the process.)
>
> I'm still left with ADMA8019E and ADMA0138W warnings at deployment relating to my Activation Specifications, though, but it seems to be working so I'll investigate those later.
>
> Thanks to everyone for the help!
>
> Cheers,
>
> =Per

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com