Hello everyone,

We're trying to deploy our application to an Apache Tomcat 7 and are having 
problems visiting the app's pages because of JPA problems.

First: Deploying the application to an embedded Jetty 9.2 works. Using the app, 
too.

We've had problems deploying the app to Tomcat at first because we have a 
dependency to tapestry-jpa (which in turn depends on geronimo-jpa 2.0) and a 
dependency to hibernate-entitymanager (which in turn depends on hibernate-jpa 
2.1), which depend on a different implementation of the JPA spec.

The error for the above was
ERROR] TapestryIOCModule.RegistryStartup Construction of service 
RegistryStartup failed: Error invoking service contribution method 
org.apache.tapestry5.jpa.JpaModule.startupEarly(EntityManagerManager, boolean): 
javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
org.apache.tapestry5.ioc.internal.OperationException: Error invoking service 
contribution method 
org.apache.tapestry5.jpa.JpaModule.startupEarly(EntityManagerManager, boolean): 
javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;

We excluded the geronimo-jpa dependency from tapestry-jpa (and removed the 
dependency to tapestry-test which seems to depend on geronimo-jpa, too) and 
then we were able to deploy the app.

But now we can't visit the app pages because of this error:

An unexpected application exception has occurred.Render queue error in 
BeginRender[Index:layout.if_1]: Failure reading parameter 'test' of component 
Index:layout.if_1: Exception constructing service 'SomeDAO': Unable to add 
method javax.persistence.EntityGraph createEntityGraph(java.lang.String) to 
class $EntityManager_14eaaa049ba: java.io.IOException: invalid constant type: 18

SomeDAO is a service accessing the database, injecting the EntityManager into 
the class.

What are we doing wrong?
Our setup:
<tapestry-release-version>5.3.8</tapestry-release-version>
<jquery-release-version>3.4.2</jquery-release-version>
<commons-release-version>1.3.3</commons-release-version>
<jetty-release-version>9.2.10.v20150310</jetty-release-version>
<hibernate-release-version>4.3.9.Final</hibernate-release-version>
<hibernate-validator-release-version>5.1.3.Final</hibernate-validator-release-version>
<mysql-connector-release-version>5.1.31</mysql-connector-release-version>

At the moment, Tapestry manages the transactions, we use @CommitAfter. Our 
persistence.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence";
       version="2.0">
       <persistence-unit name="unit" transaction-type="RESOURCE_LOCAL">
             <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
             <properties>
                    <property name="javax.persistence.jdbc.driver" 
value="com.mysql.jdbc.Driver"/>
                    <property name="javax.persistence.jdbc.url" 
value="jdbc:mysql://our.host:3306/db"/>
                    <property name="javax.persistence.jdbc.user" value="user"/>
                    <property name="javax.persistence.jdbc.password" 
value="pw"/>
<!--
                    <property 
name="javax.persistence.schema-generation.database.action" value="update"/>
       -->
                    <property name="hibernate.connection.provider_class" 
value="org.hibernate.connection.C3P0ConnectionProvider"/>

                    <property name="hibernate.dialect" 
value="org.hibernate.dialect.MySQLDialect" />

                    <property name="hibernate.hbm2ddl.auto" value="create" />

                    <property name="hibernate.show_sql" value = "true" />
                    <property name="hibernate.format_sql" value = "true" />
             </properties>
       </persistence-unit>
</persistence>

Do we have to let Tomcat manage transactions? Do we have to let Tomcat manage 
the db connections? Do we need to have a Data Source?

Regards,
Daniel P.

Reply via email to