tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: TransactionManager resource - no provider error
Date Tue, 10 Nov 2009 22:19:57 GMT
Actually this is one of those things that a bean is not supposed to be  
able to do and is the purpose of the UserTransaction object.  If you  
can use that instead I definitely would as it will be portable to all  
impls that pass the Java EE TCK.

That said, you could add support for injection of that type via a  
PropertiesEditor like this one:

   import javax.naming.InitialContext;
   import javax.naming.NamingException;
   import javax.transaction.TransactionManager;
   import java.beans.PropertyEditorManager;

   public class TransactionManagerEditor extends  
java.beans.PropertyEditorSupport {

       static {

       public void setAsText(String text) throws  
IllegalArgumentException {
           try {
               InitialContext context = new InitialContext();
               Object o = context.lookup("openejb:TransactionManager");
           } catch (NamingException e) {
               throw new IllegalStateException(e);

   (or here: )

You just need to make sure the TransactionManagerEditor loads fairly  
early or move the register code close to the class where the  
TransactionManager is needed.

This *should* do the trick.  You might need to add a corresponding  
<env-entry>, not sure if we require that.  If we do you can use the file which will not conflict with JBoss at  
all.  (see

We could probably add built in support for this, but for now the above  
should work.

I've added a jira for "extended" types usable with @Resource (i.e. non- 
standard), just to make sure we don't loose the feedback:

Feel free to add some more if you have any you need.  Here's the  
standard list:

Not sure if that is comprehensive, but seems to be just missing  


On Nov 10, 2009, at 12:14 PM, Jean-Louis MONTEIRO wrote:

> Hi,
> it should definitely work.
> Did you provide a mappedName ?
> Jean-Louis
> Totsline, Greg wrote:
>> Hi -
>> We are injecting a javax.transaction.TransactionManager into an  
>> EJB.  It
>> works fine under JBoss, but under OpenEJB 3.1.2  we get an
>> OpenEJBException:
>> No provider available for resource-ref 'null' of type
>> 'javax.transaction.TransactionManager' for 'MyBean'.  This is the  
>> same
>> problem reported in
>> Was there a resolution to this problem or a suggested work around?
>> Many Thanks.
>> -greg
> -- 
> View this message in context:
> Sent from the OpenEJB User mailing list archive at

View raw message