Skip to Content
Former Member
Jul 10, 2007 at 10:09 AM

EntityManager injection fails



I implemented a simple enterprise application 5 and I get the following exception:

Cannot perform injection over bean instance ...
nested exception is: Injection on field em of instance failed. 
Could not get a value to be injected from the factory.

Following, I give parts of the code I think which is related, but I'm not really sure where to look.


<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="" 
xmlns:xsi="" version="1.0" 
<persistence-unit name="pep_pu"/>

A stateless SessionBean that is supposed to use the entity bean:

public class PepBean implements PepLocal {
     @PersistenceContext(unitName="pep_pu", type=PersistenceContextType.TRANSACTION)
     private EntityManager em;

The EntityBean:

public class Requests implements Serializable {
	private int id;
	private String subjectid;
	private String actionvalue;
	private String response;
	private String subjectvalue;
	private String resourceid;
... getters/setters 

For Database I use the MAXDB 7.6 and I set up a connection in the NWDS as described "Developing Java EE 5 Apps from Scratch" (page 8/9).

The Database Setting I use are:

Connection: CE1

Schema/UserID: SAPCE1DB

I double checked that there is the table REQUESTS in the schema SAPCE1DB. Just in case, I created a table tmp_sequence for the Auto-generator, allthough I do not use key generation.

Does anyone have an idea?