Am trying to get spring 2.5 to use glassfish (2.1) persistence
handling/JTA (as a test project for trying to learn about JPA/JTA).
I'm getting a 500 internal server error with
java.lang.IllegalArgumentException: An exception occured while
creating a query in EntityManager
note The full stack traces of the exception and its root causes are
available in the Sun GlassFish Enterprise Server v2.1 logs.
but no matter where I dig in the log files I can't get any output
other than:
[#|2009-07-08T20:58:13.656+0200|INFO|sun-appserver2.1|
oracle.toplink.essentials.session.file:/Users/chris/src/twphch/
flickrvote/flickrvote-web/target/twitterphotochallenge/WEB-INF/
classes/-FlickrVote|
_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-0;|file:/Users/chris/
src/twphch/flickrvote/flickrvote-web/target/twitterphotochallenge/WEB-
INF/classes/-FlickrVote login successful|#]
[#|2009-07-08T20:58:13.656+0200|INFO|sun-appserver2.1|
javax.enterprise.system.stream.out|
_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-0;|DEBUG
httpSSLWorkerThread-8080-0
org.springframework.orm.jpa.EntityManagerFactoryUtils - Registering
transaction synchronization for JPA EntityManager
|#]
[#|2009-07-08T20:58:13.670+0200|INFO|sun-appserver2.1|
javax.enterprise.system.stream.out|
_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-0;|DEBUG
httpSSLWorkerThread-8080-0
org.springframework.orm.jpa.EntityManagerFactoryUtils - Closing JPA
EntityManager
|#]
[#|2009-07-08T20:58:13.670+0200|INFO|sun-appserver2.1|
javax.enterprise.system.stream.out|
_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-0;|DEBUG
httpSSLWorkerThread-8080-0
org.springframework.transaction.jta.JtaTransactionManager - Initiating
transaction rollback
|#]
Seems daft but I simply cannot find a stacktrace. I've tried setting
log levels for jta, persistence etc to FINEST - no luck.
Can anyone give me a hint as to where to find out what went wrong?
If relevant - the config of the app looks like:
<persistence xmlns="
http://java.sun.com/xml/ns/persistence"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="FlickrVote" transaction-type="JTA">
<jta-data-source>jdbc/FlickrVoteDS</jta-data-source>
<properties>
<property name="toplink.ddl-generation" value="create-
tables"/>
<property name="toplink.application-location" value="/
tmp/"/>
<property name="toplink.create-ddl-jdbc-file-name"
value="create.sql"/>
<property name="toplink.drop-ddl-jdbc-file-name"
value="drop.sql"/>
<property name="toplink.ddl-generation.output-mode"
value="sql-script"/>
<property name="toplink.logging.level.sql" value="FINE"/>
<property name="toplink.logging.level.transaction"
value="FINE"/>
</properties>
</persistence-unit>
</persistence>
with spring config:
<bean
class
=
"org
.springframework
.orm.jpa.support.PersistenceAnnotationBeanPostProcessor">
<property name="persistenceUnits">
<map>
<entry key="FlickrVote" value="persistence/
FlickrVote"/>
</map>
</property>
</bean>
<tx:jta-transaction-manager/>
<tx:annotation-driven/>
and finally web.xml
<persistence-unit-ref>
<persistence-unit-ref-name>persistence/FlickrVote</
persistence-unit-ref-name>
<persistence-unit-name>FlickrVote</persistence-unit-name>
</persistence-unit-ref>
The service layer classes that call the dao are marked for spring
@Transactional and the dao's themselves have a
@PersistenceUnit
private EntityManager em;
Just for fun have also tested with
<jee:jndi-lookup id="entityManagerFactory" jndi-name="java:comp/
env/persistence/FlickrVote"/>
with the same result. It gives the IllegalArgumentException but I can
find nothing else in the logs to give me a hint as to what I have wrong.