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 and other Java EE Technologies and the fly likes Error when trying to use an extended persistence context in EJB 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Error when trying to use an extended persistence context in EJB 3" Watch "Error when trying to use an extended persistence context in EJB 3" New topic
Author

Error when trying to use an extended persistence context in EJB 3

Amitav Chowdhury
Greenhorn

Joined: Nov 13, 2009
Posts: 10
Hi,

I am trying to using a stateful session bean to update an entity using extended persistence context. But I get the following error when trying to access the stateful bean from a standalone class:


Caused by: java.lang.IllegalStateException: Extended Persistence Contexts can only be invoked from within the context of the stateful session bean that declares the Extended Persistence Context.
at weblogic.deployment.ExtendedEntityManagerProxyImpl.getPersistenceContext(ExtendedEntityManagerProxyImpl.java:61)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:88)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
at weblogic.deployment.ExtendedEntityManagerProxyImpl.invoke(ExtendedEntityManagerProxyImpl.java:14)
at $Proxy114.toString(Unknown Source)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at containerNamagedEM.DeptServiceImpl.init(DeptServiceImpl.java:26)
... 40 more



Below is my stateful bean class



The standalone test class to access the session bean:



I am using weblogic 10 and below is my persistence.xml:



Can someone help me to solve this issue?

Thanks in advance,
Amitava
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error when trying to use an extended persistence context in EJB 3
 
Similar Threads
Exception got in deployment of EJB3 .ear
Problem -EJB3+JPA+HIbernate
Passed SCBCD 5.0 :)
Transactional and Extended Scoped Persistence Context does not work as per spec.
org. postgresql. util. PSQLException: ERROR: relation does not exist