Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 74C7F18307 for ; Fri, 28 Aug 2015 12:05:03 +0000 (UTC) Received: (qmail 75641 invoked by uid 500); 28 Aug 2015 12:05:02 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 75595 invoked by uid 500); 28 Aug 2015 12:05:02 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 75584 invoked by uid 99); 28 Aug 2015 12:05:02 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Aug 2015 12:05:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 988F1181939 for ; Fri, 28 Aug 2015 12:05:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.272 X-Spam-Level: *** X-Spam-Status: No, score=3.272 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, URIBL_BLOCKED=0.001, URI_HEX=1.313, URI_TRY_3LD=0.958] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id R0_yCcKMeLqR for ; Fri, 28 Aug 2015 12:04:52 +0000 (UTC) Received: from mwork.nabble.com (mwork.nabble.com [162.253.133.43]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id B7A6D2576F for ; Fri, 28 Aug 2015 12:04:51 +0000 (UTC) Received: from mjoe.nabble.com (unknown [162.253.133.57]) by mwork.nabble.com (Postfix) with ESMTP id 62E422759503 for ; Fri, 28 Aug 2015 05:05:16 -0700 (PDT) Date: Fri, 28 Aug 2015 04:59:38 -0700 (PDT) From: =?UTF-8?Q?Michael_B=C3=B6ckling?= To: users@activemq.apache.org Message-ID: <1440763178342-4701487.post@n4.nabble.com> Subject: ActiveMQ, Weblogic and XA transactions in Spring MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! I have a Spring app, and I'm trying to do XA transactions in Weblogic, using a JDBC DataSource provided via Weblogic JNDI and an external ActiveMQ instance, whose XAConnectionFactory is also provided via Weblogic JNDI. I have not managed to make it work - is this possible at all? Do I need to use the RAR? I tried, but got the following error which I have been unable to fix: Caused by: java.lang.Throwable: Substituted for missing class [1] More than one Admin Objects implement interface "javax.jms.ConnectionFactory" must be specified in admin-object-group in weblogic-ra.xml. - [2] More than one Admin Objects implement interface "javax.jms.ConnectionFactory" must be specified in admin-object-group in weblogic-ra.xml. Here are some more details about my code, using the JNDI ConnectionFactory approach: I have added a foreign JMS server in Weblogic like this: JNDI Initial Context Factory: org.apache.activemq.jndi.ActiveMQInitialContextFactory JNDI Connection URL: tcp://localhost:61616 JNDI Properties: connectionFactoryNames=XAConnectionFactory To that server definition, I have added a ConnectionFactory (Remote JNDI Name = XAConnectionFactory). Lookups work, so far so good. In my code, this is how I setup the Spring JTA: @Override @Bean @Profile(AppConfig.PROFILE_WEBLOGIC) public JtaTransactionManager transactionManager() { WebLogicJtaTransactionManager tx = new WebLogicJtaTransactionManager(); tx.afterPropertiesSet(); return tx; } And this is my JMS config: @Bean @Profile(AppConfig.PROFILE_WEBLOGIC) public ConnectionFactory connectionFactory() { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, env.getProperty(Context.INITIAL_CONTEXT_FACTORY)); props.setProperty(Context.PROVIDER_URL, env.getProperty(Context.PROVIDER_URL)); try { InitialContext ctx = new InitialContext(props); ActiveMQXAConnectionFactory connectionFactory = (ActiveMQXAConnectionFactory) ctx .lookup(env.getProperty("jms.connectionFactory")); return connectionFactory; } catch(NamingException e) { throw new RuntimeException("XAConnectionFactory lookup failed", e); } } @Bean public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() throws JMSException { DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory(); factory.setConnectionFactory(connectionFactory()); factory.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE); factory.setTransactionManager(txConfig.transactionManager()); factory.setBackOff(new FixedBackOff()); return factory; } @Bean(name = "jmsTemplate") @Override public JmsTemplate jmsTemplate() throws JMSException { JmsTemplate t = new JmsTemplate(); t.setConnectionFactory(connectionFactory()); t.setMessageTimestampEnabled(true); t.setMessageIdEnabled(true); return t; } My JMS consumer is annotated with: @Transactional @JmsListener(destination = "test.q1") Is there anything I am missing? Best regards, Michael -- View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Weblogic-and-XA-transactions-in-Spring-tp4701487.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.