This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

Amitav Chowdhury
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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(
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(
at weblogic.deployment.ExtendedEntityManagerProxyImpl.invoke(
at $Proxy114.toString(Unknown Source)
at java.lang.String.valueOf(
at java.lang.StringBuilder.append(
at containerNamagedEM.DeptServiceImpl.init(
... 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,
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic