tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: datasource & persistenceUnit configuration
Date Tue, 22 Feb 2011 19:54:34 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin,

On 2/20/2011 1:51 PM, Martin Mucha wrote:
> Yes, I know I cannot use container managed EntityManager. Tomcat does
> not support JTA, ok. But I should be able, also the article points it
> out, to use application managed EntityManager with RESOURCE_LOCAL
> transaction type. Just like in SE java.
> 
> In SE java everything works just fine for me.

Good to know.

> Actually the code looks just as in that article:
> 
> EntityManagerFactory emf =
> Persistence.createEntityManagerFactory("insolvencePU");
> EntityManager em = emf.createEntityManager();
> em.getTransaction().begin();
> 
> //and the rest of transaction.
> 
> my persistence.xml looks like:

So, this persistence.xml file works fine in a standalone Java SE
program? You should be able to get it to work under Tomcat then. Where
is your persistence.xml file when you run your standalone Java SE test
program, and what is the effective CLASSPATH?

Where is your persistence.xml file when you deploy it along with your
webapp? I would expect that it should be in WEB-INF/classes (or at the
root of a JAR file found in WEB-INF/lib).

> Line
> EntityManagerFactory emf =
> Persistence.createEntityManagerFactory("insolvencePU");
> fires an Exception complaining about unability to build
> EntityManagerFactory. That leads me to suspicion that either the
> persistence.xml, the data source or "something-else" is wrong. But I'm
> quite to unable to find out what.

I'm guessing that the Persistence framework just can't find your
configuration file.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1kFHoACgkQ9CaO5/Lv0PBbBACgi5UegxQ/aplal11hRHnGI2z0
BjYAnRCl4gFqH8H1DqmwXlB1mwzUO5YJ
=6EHI
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message