This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.IllegalStateException: Exception Description: Cannot use an EntityTransaction while using

 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using my Stateful Bean as -



but i am getting this exception-





I don't know why i am getting this exception here becuase i am using the application managed persistence context and resource local transaction.

Generelly resource local transactions can be used in Java SE client, but i am using in a Stateful Bean, but i should be able to use it here without any problem here.

Please advise.
 
Manish Shah
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do we need @PersistenceUnit annotation at line 41?.

Also I guess the default entity transaction manager is JTA, so i think you need to specify that you need Resource_Local.

In your persistence.xml file you need to remove <jta-data-source> element & add
<non-jta-data-source>RESOURCE_LOCAL</non-jta-data-source> element.

Correct me if i am wrong.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic