cancel
Showing results for 
Search instead for 
Did you mean: 

EnitytManagerFactory injection doesnt work (JPA)

Former Member
0 Kudos

Hi

I'm deploying my ejb3 module, with the simple persistence.xml file

<persistence-unit name="testUnit" transaction-type="JTA">

<jta-data-source>TESTDS</jta-data-source>

</persistence-unit>

Then in one of the deployed beans i'm trying to get EntityManasgerfactory trough a container injection mechanism:

@PesistentUnit(unitName="testUnit")

EntityManagerFactory emf.

this unfortunately causes the following error:

Could not get a value to be injected from the factory.

at com.sap.engine.services.ejb3.util.pool.ContainerPool.translate(ContainerPool.java:288)

....

Caused by: com.sap.engine.services.orpersistence.container.exceptions.ResourceException: Application 'com.Test/Test' is not deployed, not started or doesn't contain persistence units.

at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getApplication(ORPersistenceObjectFactory.java:192)

at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getObjectInstance(ORPersistenceObjectFactory.java:58)

at com.sap.engine.lib.injection.ReferenceObjectFactory.getObject(ReferenceObjectFactory.java:65)

at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:113)

The application is up and running, of course except for the part using JPA.

Br

PF

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Seems your persistence unit is not recognized. Where is your persistence.xml packed?

You can also try to run the telnet command

LIST_EL -a com.Test/Test

to list the deployed components of your application.

HTH!

\-- Vladimir

PS: Moving this thread to the Java EE 5 @ SAP forum.

Edited by: Vladimir Pavlov on Mar 27, 2008 8:14 PM

Former Member
0 Kudos

Hi

That's what i thought.

The persistence.xml file is in the ejb's META-INF dir, next to ejb-jar.xml.

I've listed the application elements, and nothing that would indicate that peristeence.xml had been loaded was there.

Br

PF

Former Member
0 Kudos

Hi

A though came to me : maybe its because the ejb module is not recognized as a ejb3 module, but ejb2 perhaps .

I keap my configuration in the ejb-jar-x.ml file (version 3.0) and I don't use annotaions.

Br

PF

Vlado
Advisor
Advisor
0 Kudos

The question would be more like if your app is Java EE 5 or lower. If it's lower the persistence.xml would not be processed. So please check the version of your application.xml (if present - if there isn't an application.xml then your app is Java EE 5 and we should investigate further).

\-- Vladimir

Former Member
0 Kudos

Hi

You are 100% percent right, apllication.xml file had wrong version.

Thx a lot.

Br

PF

Answers (0)