geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim085 <sim...@hotmail.com>
Subject Re: @PersistenceContext not working
Date Sun, 26 Dec 2010 18:13:59 GMT


> Open  the description and read it;

Thanks. I re-read the description and copied the geronimo-web.xml into my
openejb-jar.xml. I read the exceptions I was getting on deployment very
carefully and removed the parts it was complaining about. Now I finally
managed to deploy my ejb jar file on it's own and also as part of an ear
file without any problems. HOWEVER I still have problems :( 

Here is my openejb-jar.xml

-----
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
    
	<environment>
        <moduleId>
            <artifactId>MyJPA</artifactId>
        </moduleId>
        <dependencies>
            <dependency>
                <groupId>console.dbpool</groupId>
                <artifactId>My_JPA_JTA_DS</artifactId>
            </dependency>
        </dependencies>
    </environment>

</openejb-jar> 
-----

My problem is that I still get a java.lang.NullPointerException wehn I try
to use the EntityManager initialised using the @PersistenceContext. My
persistence.xml is now as follows;

-----
<?xml version="1.0" encoding="UTF-8"?>
<persistence ... >
	<persistence-unit name="TestApp" transaction-type="JTA">
	
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
		<jta-data-source>My_JPA_JTA_DS</jta-data-source>
	</persistence-unit>
</persistence>
-----

and the code is as follows;

-----
	@PersistenceContext(unitName="TestApp")
	private EntityManager entityManager;
-----

I really don't know what I am doing wrong and why @PersistenceContext is not
initialising my EntityManage. As much as I know all should be fine and
therefore do not know what I am lacking!
-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/Re-PersistenceContext-not-working-tp2131727p2148211.html
Sent from the Users mailing list archive at Nabble.com.

Mime
View raw message