tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: datasource & persistenceUnit configuration
Date Tue, 22 Feb 2011 19:54:34 GMT
Hash: SHA1


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
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message