You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by sebersole <st...@hibernate.org> on 2015/05/15 16:56:42 UTC

JTA TransactionManager not found

I am trying to investigate why locating the JTA TransactionManager suddenly
stopped working.  This is part of the Hibernate OSGi integration testing, so
I do not have an "app" per-se.  I also unfortunately do not have a ton of
OSGi experience and/or knowledge.  Now that all the disclaimers are out of
the way ;)

Ultimately the new failure boils down to a call to this code:

	public <T> T getServiceImpl(Class<T> contract) {
		final ServiceTracker serviceTracker = getServiceTracker(
contract.getName() );
		try {
			return (T) serviceTracker.waitForService( 1000 );
		}
		catch (Exception e) {
			LOG.unableToDiscoverOsgiService( contract.getName(), e );
			return null;
		}
	}


passing in javax.transaction.TransactionManager.  The Hibernate bundles
define javax.transaction as an import:

    Import-Package: ..., javax.transaction;version="[1.1,2)", ...


and the feature I am using defines JTA as a bundle:

   
<bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>

This code used to work.  It is failing on someone's topic branch, for
reasons we cannot explain.  As far as I know, defining the import of
`javax.transaction;version="[1.1,2)"` in the OSGi headers ought to be enough
for JTA to be there.  What am I missing?




--
View this message in context: http://karaf.922171.n3.nabble.com/JTA-TransactionManager-not-found-tp4040381.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: JTA TransactionManager not found

Posted by David Jencks <da...@yahoo.com>.
you need a bundle that exposes the tx manager as a service.  I don't know how the stuff you are using is packaged, but if I were doing it now I'd put the jta interfaces in the same bundle as the tx manager.  In any case the geronimo-spec bundle isn't going to include the implementation.  I think there's an aries bundling of the geronimo tx manager for osgi???

hope this helps a bit
david jencks

On May 15, 2015, at 10:56 AM, sebersole <st...@hibernate.org> wrote:

> I am trying to investigate why locating the JTA TransactionManager suddenly
> stopped working.  This is part of the Hibernate OSGi integration testing, so
> I do not have an "app" per-se.  I also unfortunately do not have a ton of
> OSGi experience and/or knowledge.  Now that all the disclaimers are out of
> the way ;)
> 
> Ultimately the new failure boils down to a call to this code:
> 
> 	public <T> T getServiceImpl(Class<T> contract) {
> 		final ServiceTracker serviceTracker = getServiceTracker(
> contract.getName() );
> 		try {
> 			return (T) serviceTracker.waitForService( 1000 );
> 		}
> 		catch (Exception e) {
> 			LOG.unableToDiscoverOsgiService( contract.getName(), e );
> 			return null;
> 		}
> 	}
> 
> 
> passing in javax.transaction.TransactionManager.  The Hibernate bundles
> define javax.transaction as an import:
> 
>    Import-Package: ..., javax.transaction;version="[1.1,2)", ...
> 
> 
> and the feature I am using defines JTA as a bundle:
> 
> 
> <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
> 
> This code used to work.  It is failing on someone's topic branch, for
> reasons we cannot explain.  As far as I know, defining the import of
> `javax.transaction;version="[1.1,2)"` in the OSGi headers ought to be enough
> for JTA to be there.  What am I missing?
> 
> 
> 
> 
> --
> View this message in context: http://karaf.922171.n3.nabble.com/JTA-TransactionManager-not-found-tp4040381.html
> Sent from the Karaf - User mailing list archive at Nabble.com.


Re: JTA TransactionManager not found

Posted by sebersole <st...@hibernate.org>.
Perfecto.  I only use javax.transaction.TransactionManager,
javax.transaction.TransactionSynchronizationRegistry,
javax.transaction.UserTransaction from Hibernate so that's fine.

Thanks!



--
View this message in context: http://karaf.922171.n3.nabble.com/JTA-TransactionManager-not-found-tp4040381p4040389.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: JTA TransactionManager not found

Posted by James Carman <ja...@carmanconsulting.com>.
The "transaction" feature will set up a transaction manager (the geronimo
one) and expose services that supports many of the popular ways to handle
transactions:

javax.transaction.TransactionManager,
javax.transaction.TransactionSynchronizationRegistry,
javax.transaction.UserTransaction,
org.apache.geronimo.transaction.manager.RecoverableTransactionManager,
org.springframework.transaction.PlatformTransactionManager

On Fri, May 15, 2015 at 1:13 PM sebersole <st...@hibernate.org> wrote:

> I have not.  I will try that now.  I think the developers of that branch
> inadvertently set up the tests to use JTA.  As I said these pass on master
> as is (no explicit JTA support), so that has to be it.  Great to know about
> the "transaction" feature as I would like to test JTA support as well.
> Thanks!
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/JTA-TransactionManager-not-found-tp4040381p4040387.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: JTA TransactionManager not found

Posted by sebersole <st...@hibernate.org>.
I have not.  I will try that now.  I think the developers of that branch
inadvertently set up the tests to use JTA.  As I said these pass on master
as is (no explicit JTA support), so that has to be it.  Great to know about
the "transaction" feature as I would like to test JTA support as well. 
Thanks!



--
View this message in context: http://karaf.922171.n3.nabble.com/JTA-TransactionManager-not-found-tp4040381p4040387.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: JTA TransactionManager not found

Posted by James Carman <ja...@carmanconsulting.com>.
Have you tried turning on the "transaction" feature in Karaf?

On Fri, May 15, 2015 at 10:56 AM sebersole <st...@hibernate.org> wrote:

> I am trying to investigate why locating the JTA TransactionManager suddenly
> stopped working.  This is part of the Hibernate OSGi integration testing,
> so
> I do not have an "app" per-se.  I also unfortunately do not have a ton of
> OSGi experience and/or knowledge.  Now that all the disclaimers are out of
> the way ;)
>
> Ultimately the new failure boils down to a call to this code:
>
>         public <T> T getServiceImpl(Class<T> contract) {
>                 final ServiceTracker serviceTracker = getServiceTracker(
> contract.getName() );
>                 try {
>                         return (T) serviceTracker.waitForService( 1000 );
>                 }
>                 catch (Exception e) {
>                         LOG.unableToDiscoverOsgiService(
> contract.getName(), e );
>                         return null;
>                 }
>         }
>
>
> passing in javax.transaction.TransactionManager.  The Hibernate bundles
> define javax.transaction as an import:
>
>     Import-Package: ..., javax.transaction;version="[1.1,2)", ...
>
>
> and the feature I am using defines JTA as a bundle:
>
>
> <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
>
> This code used to work.  It is failing on someone's topic branch, for
> reasons we cannot explain.  As far as I know, defining the import of
> `javax.transaction;version="[1.1,2)"` in the OSGi headers ought to be
> enough
> for JTA to be there.  What am I missing?
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/JTA-TransactionManager-not-found-tp4040381.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>