Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Migration from 4.0.5 to 4.2.3

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I test migration from JBoss 4.0.5 to 4.2.3. It is not an easy task, many libs has changed, but there is one thing that hits my applications - JBossTS. I have couple of stateless session beans, that have methods with differet transaction attributes. In areas where I don't need transaction management I use data access objects. Now, my applications crashes on session beans, giving the exception:

"Adding multiple last resources is disallowed"

Great, I dig the web then and find solution at jboss.org:

"Wrap the resources in compensating transactions. See the Web Services transactions guides for further details.
Migrate the legacy implementations to two-phase aware equivalents. For DataSources deployed on JBoss Application Server, this is as simple as changing from <local-tx-datasource> to <xa-datasource>. See ConfigDataSources for more information.
Refactor the code to use separate transactions. If you simply need to read from one DataSource and insert processed results into another, you may not want or need 2-phase commit (and thus the above optimization). In an EJB3 session bean, this can be accomplished by simply delegating the read to a separate method and annotating it with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW). This causes the calling method's Transaction to suspend, wait for the read to complete, and resume."

If I want to follow this instruction I have to change code in every place from DataSource object to XADataSource. Ok, I can live with this. But changing attribute to REQUIRES_NEW?! What for I have other types then?

Do I miss something? What I understand wrong? Is it really only way to upgrade my applications so it work under 4.2.3?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by M Glowacki:
If I want to follow this instruction I have to change code in every place from DataSource object to XADataSource. Ok, I can live with this. But changing attribute to REQUIRES_NEW?! What for I have other types then?



If you are going to use a XADatasource then there won't be any need to change the transaction attribute to REQUIRES_NEW. But remember, that it's finally upto the business logic to decide which transaction attribute it needs to use. See the "Transaction Attributes" section in this document for details about transaction attributes.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic