Try Aries?
On Apr 20, 2012 5:51 AM, "DEPREZ Arnaud AWL-IT" <[email protected]>
wrote:

>  Hi all,****
>
> ** **
>
> I use ServiceMix 4.3.1 with the felix framework.****
>
> I would like to use the JTA TransactionManager from Geronimo with
> hibernate.****
>
> ** **
>
> Regarding to the documentation, it seems that we have to redefine our own
> TransactionManagerLookup class in order to tell to hibernate how to get the
> right TransactionManager.****
>
> See the documentation here :
> https://cwiki.apache.org/GMOxDOC10/jboss-to-geronimo-hibernate-migration.html
> ****
>
> ** **
>
> I find a simple sample that someone wrote on the web (see below), but it
> uses the eclipse DefaultClassLoader which I guess isn’t the same that the
> felix class loader.****
>
> ** **
>
> Does someone have any idea of how to adapt the sample with the felix
> framework ?****
>
> ** **
>
> Here is the class : ****
>
> ** **
>
> import java.util.Properties;****
>
> ****
>
> import javax.transaction.Transaction;****
>
> import javax.transaction.TransactionManager;****
>
> ****
>
> import org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader;****
>
> import org.hibernate.transaction.TransactionManagerLookup;****
>
> import org.osgi.framework.BundleContext;****
>
> import org.osgi.framework.InvalidSyntaxException;****
>
> import org.osgi.util.tracker.ServiceTracker;****
>
> ****
>
> public class OsgiTransactionManagerLookup implements
> TransactionManagerLookup {****
>
>     private static TransactionManager transactionManager;****
>
>     ****
>
>     @Override****
>
>     public TransactionManager getTransactionManager(Properties props) {***
> *
>
>         try {****
>
>             if (transactionManager == null) {****
>
>                 DefaultClassLoader classLoader = (DefaultClassLoader)
> this.getClass().getClassLoader();****
>
>                 BundleContext context =
> classLoader.getBundle().getBundleContext();****
>
>                 ServiceTracker serviceTracker = new
> ServiceTracker(context,
> context.createFilter("(objectClass=javax.transaction.TransactionManager)"),
> null);            ****
>
>                 serviceTracker.open();****
>
>                 transactionManager = (TransactionManager)
> serviceTracker.getService();****
>
>             }****
>
>         } catch (InvalidSyntaxException e) {****
>
>             throw new IllegalStateException("No
> javax.transaction.TransactionManager found as OSGi service.", e);****
>
>         }****
>
>         ****
>
>         return transactionManager;****
>
>     }****
>
> ****
>
>     @Override****
>
>     public String getUserTransactionName() {****
>
>                 return "java:comp/UserTransaction";  ****
>
>                 }****
>
> ****
>
>     @Override****
>
>     public Object getTransactionIdentifier(Transaction transaction) {****
>
>         return transaction;****
>
>     }****
>
> }****
>
> ** **
>
> [image: blue_strip]
> *Arnaud Deprez*
> Analyst-Programmer
> Acquiring Back-Office
> +32 2 727 72 09
> [email protected]<http://intranet.atosworldline.com/Region1-fr/[email protected]>
> Chaussee de Haecht 1442 Haachtsesteenweg
> 1130 Brussels
> Belgium
> atosworldline.be
> [image: Atos Worldline logo]****
>
> P please don't print unless you really need to   ****
>
> ** **
>
> ------------------------------
>
> Atos Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg
> - 1130 Brussels - Belgium
> RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872
> Bankrekening-Compte Bancaire-Bank Account 310-0269424-44
> BIC BBRUBEBB - IBAN BE55 3100 2694 2444
>
> "The information contained in this e-mail and any attachment thereto is
> confidential and may contain information which is protected by intellectual
> property rights.
> This information is intended for the exclusive use of the recipient(s)
> named above.
> This e-mail does not constitute any binding relationship or offer toward
> any of the addressees.
> If you are not one of the addressees , one of their employees or a proxy
> holder entitled to hand over this message to the addressee(s), any use of
> the information contained herein (e.g. reproduction, divulgation,
> communication or distribution,...) is prohibited.
> If you have received this message in error, please notify the sender and
> destroy it immediately after.
> The integrity and security of this message cannot be guaranteed and it may
> be subject to data corruption, interception and unauthorized amendment, for
> which we accept no liability."
>

Reply via email to