You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Yann Andenmatten <YA...@odyssey-group.com> on 2008/11/25 16:15:27 UTC
ArgumentException (Incomplete initialisation of EntityManager)
Hi,
We are in the process of testing OpenJPA's performance on large volume.
To measure it, we uses junitperf which execute simultaneously the same
unit test in separate threads.
Some time the test succeeded, some time I get this error (which excludes
a configuration problem):
1)
testPortfolioType(MultithreadedQueriesTest)<openjpa-1.2.0-r422266:683325
nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
An error occurred while parsing the query filter "SELECT e FROM
SomeEntity29 e". Error message: The name "SomeEntity29" is not a
recognized entity or identifier. Perhaps you meant SomeEntity29, which
is a close match. Known entity names: [SomeEntity18, SomeEntity19,
SomeEntity16, SomeEntity17, SomeEntity14, SomeEntity15, SomeEntity12,
SomeEntity13, SomeEntity10, SomeEntity6, SomeEntity11, SomeEntity5,
SomeEntity4, SomeEntity3, SomeEntity2, SomeEntity1, Client,
SomeEntity20, SomeEntity22, SomeEntity21, SomeEntity24, SomeEntity9,
SomeEntity23, SomeEntity26, SomeEntity8, SomeEntity7, SomeEntity25,
SomeEntity28, SomeEntity27, SomeEntity29]
at
org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(
AbstractExpressionBuilder.java:118)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JP
QLExpressionBuilder.java:177)
[...]
As you can see in this particular execution is that SomeEntity29 is not
recognized as an entity, but it appears on the known entity names. This
lets me think the initialization continued after the error occurs and
before the error message is printed.
I tried to create and close a dummy EntityManager as proposed in some
thread on this mailing list:
emf = Persistence.createEntityManagerFactory("myUnit", p);
EntityManager em = emf.createEntityManager();
em.close();
Thread.sleep(5000);
No success. I also tried to force the initialization of the entities by
loading the classes:
for (int i=1; i<=29; i++) {
Class.forName("my.company.SomeEntity"+i);
}
No success too.
Any idea how to unsure the proper initialization of the EntityManager
before the first query?
Yann
(Occurred with openJPA 1.2.0 Sybase and Derby databases, sun jdk1.6)
____________________________________________________________
� This email and any files transmitted with it are CONFIDENTIAL and intended
solely for the use of the individual or entity to which they are addressed.
� Any unauthorized copying, disclosure, or distribution of the material within
this email is strictly forbidden.
� Any views or opinions presented within this e-mail are solely those of the
author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
� An electronic message is not binding on its sender. Any message referring to
a binding engagement must be confirmed in writing and duly signed.
� If you have received this email in error, please notify the sender immediately
and delete the original.
Re: ArgumentException (Incomplete initialisation of EntityManager)
Posted by Yann Andenmatten <YA...@odyssey-group.com>.
Hi Jeremy,
Yes each thread gets its own EM. All share the same EMF, but that's ok. (We
tried also the openjpa.Multithreaded property without success.)
Here is the test case:
http://n2.nabble.com/file/n1581046/MultithreadedQueriesTest.java
MultithreadedQueriesTest.java
http://n2.nabble.com/file/n1581046/persistence.xml persistence.xml
http://n2.nabble.com/file/n1581046/SomeEntity29.java SomeEntity29.java (all
entities are like this one)
If you like, I can send you all the files in a zip containing everything
including a pom to load the dependencies. Please email me directly in this
case.
Other information: OS=Windows XP, CPU=Intel Core2 Duo
Yann
--
View this message in context: http://n2.nabble.com/ArgumentException-%28Incomplete-initialisation-of-EntityManager%29-tp1577196p1581046.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ArgumentException (Incomplete initialisation of EntityManager)
Posted by Yann Andenmatten <YA...@odyssey-group.com>.
Pinaki Poddar wrote:
>
> Hi,
> By the nature of the error message, my 'guess' is it got to do with
> ClassLoading rather than initialization.
> SomeEntity29 is loaded by ClassLoader C1. While the query Q that raised
> the exception found and resolved SomeEntity29 using ClassLoader C2.
>
> Does that ring any bell in the test environment?
>
I'm running it in a single jvm as a standalone unit test. I have a
standalone project that you run with maven which fails. I can send you a zip
with it if you like.
Yann
--
View this message in context: http://n2.nabble.com/ArgumentException-%28Incomplete-initialisation-of-EntityManager%29-tp1577196p1584518.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ArgumentException (Incomplete initialisation of EntityManager)
Posted by Yann Andenmatten <YA...@odyssey-group.com>.
In fact, I get an error with this openjpa.InitializeEagerly option :
[java] 16 myUnit WARN [main] openjpa.Runtime - The configuration
property named "openjpa.InitializeEagerly" was not recognized and will be
ignored, although the name closely matches a valid property called
"openjpa.InverseManager".
I using openjpa 1.2.0.
Yann
--
View this message in context: http://n2.nabble.com/ArgumentException-%28Incomplete-initialisation-of-EntityManager%29-tp1577196p1584513.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ArgumentException (Incomplete initialisation of EntityManager)
Posted by Yann Andenmatten <YA...@odyssey-group.com>.
Hi Pinaki,
I tried without success... It seams to me that the initialisation is done in
some separate thread as the state of the entity manager evolve between the
moment the problem is detected and when the error message is built.
Yann
--
View this message in context: http://n2.nabble.com/ArgumentException-%28Incomplete-initialisation-of-EntityManager%29-tp1577196p1581066.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ArgumentException (Incomplete initialisation of EntityManager)
Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
Check if the following helps:
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#openjpa.InitializeEagerly
--
View this message in context: http://n2.nabble.com/ArgumentException-%28Incomplete-initialisation-of-EntityManager%29-tp1577196p1579808.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: ArgumentException (Incomplete initialisation of EntityManager)
Posted by Jeremy Bauer <te...@gmail.com>.
Hi Yann,
Does your test use the same entity manager concurrently on multiple threads?
Entity managers are not thread safe by definition. If that is the case,
you could try setting openjpa.Multithreaded property to true, but you'll
likely run into other state or transaction related issues. It's best to use
a unique entity manager on each thread. If you are using separate entity
managers, could you post a failing test case and information about your
system - specifically OS and the number of CPU cores.
-Jeremy
On Tue, Nov 25, 2008 at 9:15 AM, Yann Andenmatten <
YAndenmatten@odyssey-group.com> wrote:
> Hi,
>
>
>
> We are in the process of testing OpenJPA's performance on large volume.
> To measure it, we uses junitperf which execute simultaneously the same
> unit test in separate threads.
>
>
>
> Some time the test succeeded, some time I get this error (which excludes
> a configuration problem):
>
> 1)
> testPortfolioType(MultithreadedQueriesTest)<openjpa-1.2.0-r422266:683325
> nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
> An error occurred while parsing the query filter "SELECT e FROM
> SomeEntity29 e". Error message: The name "SomeEntity29" is not a
> recognized entity or identifier. Perhaps you meant SomeEntity29, which
> is a close match. Known entity names: [SomeEntity18, SomeEntity19,
> SomeEntity16, SomeEntity17, SomeEntity14, SomeEntity15, SomeEntity12,
> SomeEntity13, SomeEntity10, SomeEntity6, SomeEntity11, SomeEntity5,
> SomeEntity4, SomeEntity3, SomeEntity2, SomeEntity1, Client,
> SomeEntity20, SomeEntity22, SomeEntity21, SomeEntity24, SomeEntity9,
> SomeEntity23, SomeEntity26, SomeEntity8, SomeEntity7, SomeEntity25,
> SomeEntity28, SomeEntity27, SomeEntity29]
>
> at
> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(
> AbstractExpressionBuilder.java:118)
>
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JP
> QLExpressionBuilder.java:177)
>
> [...]
>
>
>
> As you can see in this particular execution is that SomeEntity29 is not
> recognized as an entity, but it appears on the known entity names. This
> lets me think the initialization continued after the error occurs and
> before the error message is printed.
>
>
>
> I tried to create and close a dummy EntityManager as proposed in some
> thread on this mailing list:
>
> emf = Persistence.createEntityManagerFactory("myUnit", p);
>
> EntityManager em = emf.createEntityManager();
>
> em.close();
>
> Thread.sleep(5000);
>
>
>
> No success. I also tried to force the initialization of the entities by
> loading the classes:
>
> for (int i=1; i<=29; i++) {
>
> Class.forName("my.company.SomeEntity"+i);
>
> }
>
> No success too.
>
>
>
> Any idea how to unsure the proper initialization of the EntityManager
> before the first query?
>
>
>
> Yann
>
> (Occurred with openJPA 1.2.0 Sybase and Derby databases, sun jdk1.6)
>
>
> ____________________________________________________________
>
> • This email and any files transmitted with it are CONFIDENTIAL and
> intended
> solely for the use of the individual or entity to which they are
> addressed.
> • Any unauthorized copying, disclosure, or distribution of the material
> within
> this email is strictly forbidden.
> • Any views or opinions presented within this e-mail are solely those of
> the
> author and do not necessarily represent those of Odyssey Financial
> Technologies SA unless otherwise specifically stated.
> • An electronic message is not binding on its sender. Any message referring
> to
> a binding engagement must be confirmed in writing and duly signed.
> • If you have received this email in error, please notify the sender
> immediately
> and delete the original.