First jencks 2.0 should be released soon. Second, the documentation is quite outdated, so the best place to look for examples is to download the sources and look at the junit tests.
About your problems, if you want to use JCA for outbound, you need to configure the DataSources and ConnectionFactories correctly, so that they can be enlisted in XA transactions. See http://fisheye.codehaus.org/browse/jencks/trunk/jencks/src/test/resources/org/jencks/samples/outbound/jencks-tranql.xml?r=152 for outbound JDBC, and http://fisheye.codehaus.org/browse/jencks/trunk/jencks/src/test/resources/org/jencks/samples/outbound/jencks-activemq.xml?r=152 for outbound JMS. For inbound, using JCA is more safe and efficient that using spring, because transactions are only started when needed, whereas using plain JMS api, transactions must be started before polling for a JMS message. On the spring transactional part, using a JtaPlatformTransactionManager on top of the jencks transaction manager is the way to go. If you use jencks 2.0-SNAPSHOT, the transaction manager is already a PlatformTransactionManager, so you can just use it in your transaction templates. Hopes this helps. On 12/19/06, James Adams <[EMAIL PROTECTED]> wrote:
I *think* I have worked this out, and if I have then using the Geronimo JTA Transaction Manager via Jencks is in fact as dead-simple as the documentation makes it appear. However it's so simple and too good to be true that I'm afraid I have in some way misinterpreted the results of my tests, so I want to ask this group if it's possible that it's actually working the way I think it is. I'm pretty sure that the reason I was having trouble before was not because I hadn't configured all of the outbound JDBC and JMS related beans in my Spring configuration but instead because I hadn't set the sessionTransacted property of my JmsTemplate to true. Now I am getting the test results I was expecting, and when I step through the code and view the Spring and Hibernate debug messages I am seeing the behavior I expect. I have only configured a transactionManager bean which is of the class org.jencks.factory.TransactionManagerFactoryBean (as described here http://jencks.org/Transaction+Manager), and now use this as the transactionManager referenced in my Spring AOP configuration for declarative transaction management. My tests are succeeding in rolling back both a Hibernate saveOrUpdate() and a JMS send() if either of the two fails, otherwise both are committed as expected if they both succeed. I hope someone can confirm for me that I'm not crazy and that this really is probably working like I think it is (I realize you can only surmise without seeing my configuration and codes). If I'm likely to be mistaken, i.e. this can't actually work like I think it is with such a minimal configuration, then someone please tell me what parts I am missing to make this work like I think it is already. Thanks in advance. --James James Adams wrote: > > I have been trying without success to configure my Spring application to > use the Geronimo JTA Transaction Manager via Jencks. I have run into a > few problems/questions which hopefully someone here can help me with. > Please bear in mind that I am a JTA/Jencks neophyte and hence I may not > understand some things which may be obvious to an experienced > Jencks/Geronimo developer. > > 1. Because the documentation for deploying a JTA Transaction Manager is so > sparse I assumed that this is all that necessary to have the application > use global/XA transactions -- just wire in a JTA Transaction Manager to > use as the application's transactionManager bean (referenced in the > declarative transaction management AOP configuration) and everything else > works like magic. Unfortunately this isn't appearing to be the case based > on my tests. Perhaps I have written the wrong type of tests, or I don't > know how to properly decipher the log messages, but if not then it appears > that there's more to it than this. Am I right in this assumption? > > 2. Assuming that I am correct in that I need to do some more wiring of my > DataSource and JMS components then I probably need to follow the > instructions in the Jencks Documentation for Outbound JDBC, Outbound JMS, > and Message-Driven POJOs. I started down this path and I soon ran across > a big problem -- in both the Outbound JDBC and Outbound JMS documentation > sections the example configuration for the connectionManager bean includes > a transactionManager property, but when I run my application Spring > complains that such a property doesn't exist for this bean's class > (org.jencks.factory.ConnectionManagerFactoryBean): > > Caused by: org.springframework.beans.NotWritablePropertyException: Invalid > property 'transactionManager' of bean class > [org.jencks.factory.ConnectionManagerFactoryBean]: Bean property > 'transactionManager' is not writable or has an invalid setter method. Does > the parameter type of the setter match the return type of the getter? > > Is this another example of the documentation only being relevant to the > new 2.0-SNAPSHOT development release, and there is some wrapper trick > needed if using the latest stable 1.3 release of Jencks? If not then is > the documentation incorrect in that there's actually another class that > should be used for this bean? > > 3. The Outbound JMS section of the documentation specifies the class > org.jencks.factory.ConnectionFactoryFactoryBean for the > jmsConnectionFactory bean, however this class doesn't exist in the Jencks > 1.0 API as far as I can tell, and I can't find another class to use which > may have been the intended class for the example. Can anyone clarify > and/or suggest how I can work around this? > > 4. I haven't gotten around to applying the Message Driven POJOs section of > the documentation to my application's configuration, and I'm hesitant to > do so because I already have the Message Driven POJOs part of my > application working well using Spring's DefaultMessageListenerContainer. > Do I really need to modify my configuration according to the Jencks > documentation, or could I just specify my DefaultMessageListenerContainer > to use the JTA Transaction Manager from the Jencks configuration and call > it good? (I'm afraid that this would be too simple of a configuration > modification, based on my experience up to this point.) > > Thanks in advance for any help. > > > --James > -- View this message in context: http://www.nabble.com/Problems-configuring-my-application-for-JTA-transaction-management-of-Hibernate-%2B-JMS-tf2834029.html#a7944015 Sent from the jencks - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
-- Cheers, Guillaume Nodet --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
