• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

One Phase and Two Phase Error

 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am facing an error as below when calling my session bean which in turn calls the dao to connect to the database and perform some sql activities. It seems that the error only occured after the whole transaction completes (it manages to connect to the database and return results at the dao level). I have also created a basic non-two phase jdbc connection provider and not a two phase. Is there something wrong with the driver or my setting at the websphere admin console? Any help is very much appreciated.

Error: An attempt to use a one phase resource with an existing two phase resource is not allowed...
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try Setting TXN attribute of the EJB service to Requires New.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When running a Global transaction with an unshareable mode where two or more connections are created as part of the Global transaction, Oracle throws the exception "ora-02051: another session in same transaction failed" when doing a rollback or commit on the Global transaction.

Use Sharable mode when running a bean-managed persistence (BMP) or servlet to work around the problem as follows:

BMP:
Set the res-sharing-scope tag to Sharable in the ejb-jar.xml file, which is found in the META-INF directory of the yourbean.jar file. For example:

Shareable

Servlet:
Set the res-sharing-scope tag to Sharable in the web.xml file, which is found in the WEB-INF directory of the .war file. For example:

Shareable


This situation is a recognized Oracle problem. The Oracle bug number is 2511780.

I followed the above specified solution and was able to solve the problem..

all the best..
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For one pharse commit error, it sometimes depends on the type of connection. Setting the EJB transaction attributes will not help, as the resources do not release.

You may try to set the container type from per connection or per container, or vice verse, in the application.xml.

Nick
 
Bras cause cancer. And tiny ads:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic