We(Arnaud and I) are trying to use Aries under ServiceMix, with Spring, camel, hibernate and ActiveMQ. We probably have potential errors -> see below:
What we did: In ServiceMix, Aries is exposed as a TransactionManager/UserTransaction(it implements both) service and we already have its reference. Problem1: With ActiveMQ only, we set ActiveMq Component + JMSPool with Aries Trx Manager and set ActiveMq component transactional property to "false" . Despite the fact it seems to behave correctly , I 'd like to enable traces on Ariesto ensure ActiveMQ component is NOT instanciating local JMSTransactionManager and well using Aries instead BUT I do not know how to enable Aries Traces! Any clue? Problem2: when we try to involve Hibernate, hibernate complains and asks for the transactionManager and userTransaction . To solve this, we provided hibetnate entitymanager with transactionManagerLookup but hibernate also tries to get the JNDI java:comp/UserTransaction AND we do not know why using JNDI, we'd like to use the osgi userTransaction service instead(the one we have in Spring Context from OSGI service). Does anybody have an idea about how to configure Hibernate to take Aries TransactionManager + userTransaction in count? Many thanks, Michael. -----Original Message----- From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On Behalf Of James Carman Sent: Friday 20 April 2012 14:25 To: users@servicemix.apache.org Subject: Re: write TransactionManagerLookup with geronimo for hibernate How are you using JPA/Hibernate? Are you using Spring to wire everything together? If so, I think Aries will publish a PlatformTransactionManager which you can use to manage your transactions with Spring. Either way, you can set up OSGi service references to grab what you need. On Fri, Apr 20, 2012 at 7:32 AM, DEPREZ Arnaud AWL-IT <arnaud.dep...@atos.net> wrote: > Thanks for your answer but the GeronimoTransactionManager is the transaction > manager from Aries. > > When we instanciate the JPA/Hibernate EntityManager, it complains and ask for > for a TransactionManager. > According to the documentation, we must provide a TransactionManagerLookup to > hibernate if he can't the TransactionManager by itself. > > I didn't find a TransactionManagerLookup for ServiceMix and again according > to the documentation, it seems that I have to redefine it... > It's very boring but I don't know how to do in another way. > > Arnaud Deprez > > please don't print unless you really need to > > > -----Original Message----- > From: James Carman [mailto:jcar...@carmanconsulting.com] > Sent: vendredi 20 avril 2012 13:12 > To: users@servicemix.apache.org > Subject: Re: write TransactionManagerLookup with geronimo for hibernate > > Try Aries? > On Apr 20, 2012 5:51 AM, "DEPREZ Arnaud AWL-IT" <arnaud.dep...@atos.net> > 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 >> arnaud.dep...@atos.net<http://intranet.atosworldline.com/Region1-fr/firstname.lastn...@atos.net> >> 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." >> > > > 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." 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."