File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes java.lang.IllegalStateException:  Exception Description: Cannot use an EntityTransaction while using Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "java.lang.IllegalStateException:  Exception Description: Cannot use an EntityTransaction while using" Watch "java.lang.IllegalStateException:  Exception Description: Cannot use an EntityTransaction while using" New topic
Author

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

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
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.


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Manish Shah
Greenhorn

Joined: Jun 09, 2002
Posts: 22
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.




SCBCD5, SCWCD, SCJP, MCP
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.lang.IllegalStateException: Exception Description: Cannot use an EntityTransaction while using