This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB local injection and transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "EJB local injection and transactions" Watch "EJB local injection and transactions" New topic
Author

EJB local injection and transactions

Cristina Yenyxe
Greenhorn

Joined: May 04, 2010
Posts: 6
Hello,

I'm developing a JavaEE6 application, and I need to communicate two EJBs, one in the business tier and the other in the persistence tier. The persistence EJB doesn't deal with a model, it just queries a chaotic database running on SQL Server 2005, but I use an EntityManager so I don't have to worry about transactions anyway ;) So the code is something like this:

Bussiness EJB:

Persistence EJB (Local interface):

Persistence EJB (implementation):

I've checked it's not a problem with the connection between the EJBs adding a method with no persistence access and it works like a charm. And it shouldn't be a problem with the persistence unit configuracion 'cause when I turned the LogReader class into a @ManagedBean it also works.
But this way, when it gets to the 'em.createNamedQuery' statement it shows the following error: 'javax.ejb.EJBException: Unable to complete container-managed transaction.'

And the stack trace is:

Sorry for the stack trace's length, but I guess it is better for it to be too long than too short
Does somebody have any idea? Thanks in advance.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: EJB local injection and transactions
 
Similar Threads
ProgrammaticLogin in EJB - Oracle Glassfish 3.1 and JSP
SAAJ client issue
Connection Multiple Databases with diynamically persistence unit names
javax.mail error
Exception on DB2 query with Hibernate JPA2