Hi, I already did that. Separately, JMS and BD works.
Sasa willem.jiang wrote: > > Another suggestion, you can try to make the JMS and DB work separately > before you get them work together. > > Willem > > Claus Ibsen wrote: >> Hi >> >> Which versions of the various products are you using? >> >> And when you get an error shown the real stacktrace / error message >> helps. >> >> And try use google on this exception / stacktrace to find others with >> same problem. >> >> And try get a sample working with Oracle + Spring + JDBC + XA to >> ensure that combo works before throwing in annotations, aop and other >> stuff that just complicates matter. >> >> And there was an issue in Camel 1.6.0 or older with sometimes Spring >> did not do IoC on classes with @annotations. It did output something >> about bean XXX not being eligible for ... So check whether Spring >> logs this in your case. >> >> >> On Mon, Aug 3, 2009 at 5:57 PM, >> smilicevics<[email protected]> wrote: >>> Hi, >>> >>> I am trying to write code which will consume a message and do the insert >>> in >>> database. >>> I want to use global transactions and two-phase-commit. >>> >>> I got always the same error: cannot commit in global transaction. >>> Can somebody tell me what am i doing wrong here: >>> >>> this is my spring xml: >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> >>> <beans xmlns="http://www.springframework.org/schema/beans" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xmlns:camel="http://activemq.apache.org/camel/schema/spring" >>> xmlns:tx="http://www.springframework.org/schema/tx" >>> xmlns:aop="http://www.springframework.org/schema/aop" >>> xsi:schemaLocation=" >>> http://www.springframework.org/schema/beans >>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd >>> http://activemq.apache.org/camel/schema/spring camel-spring.xsd >>> http://www.springframework.org/schema/tx >>> http://www.springframework.org/schema/tx/spring-tx-2.0.xsd >>> http://www.springframework.org/schema/aop >>> http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> >>> >>> >>> <camel:camelContext id="camel"> >>> <camel:route> >>> <camel:from >>> uri="oracle:queue:java:comp/resource/WeborderJmsResourceProvider/Queues/JMSEXAMPLE?maxMessagesPerTask=-1" >>> /> >>> <camel:to uri="bean:testProcessor" /> >>> </camel:route> >>> </camel:camelContext> >>> >>> <camel:template id="camelTemplate" /> >>> >>> <bean id="oracle" >>> class="org.apache.camel.component.jms.JmsComponent"> >>> <property name="connectionFactory" >>> ref="oJmsQueueConnectionFactory" /> >>> <property name="destinationResolver" >>> ref="jmsDestinationResolver" /> >>> <property name="transacted" value="true" /> >>> <property name="transactionManager" >>> ref="transactionManager" /> >>> </bean> >>> >>> <bean id="jmsDestinationResolver" >>> >>> class="org.springframework.jms.support.destination.JndiDestinationResolver"> >>> <property name="jndiTemplate" ref="jndiTemplate" /> >>> <property name="cache" value="true" /> >>> </bean> >>> >>> <bean id="transactionManager" >>> class="org.springframework.transaction.jta.OC4JJtaTransactionManager" /> >>> >>> <bean id="oJmsQueueConnectionFactory" >>> class="org.springframework.jndi.JndiObjectFactoryBean"> >>> <property name="jndiTemplate" ref="jndiTemplate" /> >>> <property name="jndiName"> >>> >>> <value>java:comp/resource/WeborderJmsResourceProvider/QueueConnectionFactories/QCF</value> >>> </property> >>> </bean> >>> >>> <bean id="jndiTemplate" >>> class="org.springframework.jndi.JndiTemplate" /> >>> >>> <bean id="testProcessor" class="oc4j.test.TestProcessor"> >>> <property name="testImpl" ref="testImpl" /> >>> </bean> >>> >>> <bean id="testDataSource" >>> class="org.springframework.jndi.JndiObjectFactoryBean"> >>> <property name="jndiName" value="jdbc/WeborderJmsDS" /> >>> </bean> >>> >>> <bean id="testImpl" class="oc4j.test.TestImpl"> >>> <property name="dataSource" ref="testDataSource" /> >>> </bean> >>> >>> <aop:config> >>> <aop:pointcut id="process" expression="execution(* >>> oc4j.test.*)"/> >>> <aop:advisor pointcut-ref="process" >>> advice-ref="txAdvice"/> >>> </aop:config> >>> >>> <tx:advice id="txAdvice" >>> transaction-manager="transactionManager"> >>> <tx:attributes> >>> <tx:method name="process" >>> propagation="REQUIRED"/> >>> </tx:attributes> >>> </tx:advice> >>> >>> </beans> >>> >>> and TestProcessor: >>> >>> public class TestProcessor implements Processor { >>> >>> private TestImpl test = null; >>> >>> public void setTestImpl(TestImpl test) { >>> this.test = test; >>> } >>> >>> @Transactional(propagation = Propagation.REQUIRED) >>> public void process(Exchange arg0) throws Exception { >>> >>> Logger logger = Logger >>> >>> .getLogger("oc4j.test.Oc4jServletContextListener"); >>> >>> test.insertTest(); >>> logger.info("Received exchange: " + arg0.getIn()); >>> logger.info("Received exchange: " + >>> arg0.getIn().getBody()); >>> } >>> } >>> >>> and TestImpl: >>> >>> public class TestImpl extends JdbcDaoSupport { >>> >>> public void insertTest() { >>> getJdbcTemplate().execute("insert into test values ('this >>> is only >>> test')"); >>> } >>> } >>> >>> >>> thanks in advance. >>> >>> Sasa >>> >>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Two-Phase-Commit-with-JCA%2C-Spring%2C-Camel-and-OC4j-tp24793274p24793274.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> > > > -- View this message in context: http://www.nabble.com/Two-Phase-Commit-with-JCA%2C-Spring%2C-Camel-and-OC4j-tp24793274p24804576.html Sent from the Camel - Users mailing list archive at Nabble.com.
