Error Deploying JPA Application in EAP 6 with Extended Persistence Context.

Solution Verified - Updated -

Issue

I’m having an issue with deploying a Java EE RESTful service to EAP that has a JPA library as one of its dependencies. The EntityManager injected into the JPA library's service class thusly:

@Stateless
@EJB(name = "DataService", beanName = "DataService", beanInterface = DataService.class)
@LocalBean
public class DataService implements GenericService
{
    @PersistenceContext(unitName = "convergence")
    private EntityManager em;

    @Override
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public <T> T create(T t)
...

Because we had to set the TransactionAttributeType.REQUIRES_NEW attribute on the create and update methods, our entities are detached and I can’t call the refresh method. So, I updated our PersistenceContext annotation be extended:

@Stateless
@EJB(name = "DataService", beanName = "DataService", beanInterface = DataService.class)
@LocalBean
public class DataService implements GenericService
{
    @PersistenceContext(unitName = "convergence", type=PersistenceContextType.EXTENDED)
    private EntityManager em;

. . . snip . . .
}

But, when I try to deploy the app, I get this error in JBoss EAP:

2014 Aug 13 13:51:23,560 Processor [http-/0.0.0.0:8080-3] ERROR ca.test.processor.resource.ProcessorResource - : Caught exception: JBAS011048: Failed to construct component instance
javax.ejb.EJBTransactionRolledbackException: JBAS011048: Failed to construct component instance

What does this error mean and how do I troubleshoot/fix it?

Environment

  • Red Hat JBoss Enterprise Application Platform
    • 6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content