That is odd. Could you include the full exception stack trace to both
exceptions.
The first error seems like it may be memory related, try increasing your
JVM memory to see if it affects the error.
The second error is odd, are you defining the same query twice? Perhaps
in a superclass and subclass, or in annotations and orm.xml? Is there
anything non-standard about your configuration or deployment?