Hi,
I am sorry, the exception is exactly the same no matter if I add
AbstractBaseEntity to PU or not. The other exception came from usage of
generics at some point in my numerous re-factorings.
Please find the complete log output from the test-run I just made with
AbstractBaseEntity in PU here: https://gist.github.com/anonymous/5689822
Again, this VERY SAME config works just fine when running in TomEE.
The config looks like this:
orm.xml
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
version="2.0">
<persistence-unit-metadata>
<persistence-unit-defaults>
<access>FIELD</access>
</persistence-unit-defaults>
</persistence-unit-metadata>
<entity class="my.base.AbstractBaseEntity" />
<entity class="my.access.Permission" />
...
</entity-mappings>
persistence.xml
<persistence version="2.0"
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_2_0.xsd">
<persistence-unit name="default" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>ICDatabase</jta-data-source>
<non-jta-data-source>ICDatabaseNonJta</non-jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<properties>
<property name="openjpa.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=144,
PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000,
TestOnBorrow=true" />
<property name="openjpa.Log" value="DefaultLevel=Trace" />
<property name="openjpa.TransactionMode" value="managed" />
<property name="openjpa.jdbc.DBDictionary"
value="org.apache.openjpa.jdbc.sql.DerbyDictionary" />
<property name="openjpa.jdbc.Schema" value="ic" />
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema" />
<property name="openjpa.jdbc.SchemaFactory"
value="native(ForeignKeys=true)"/>
<property name="openjpa.DynamicEnhancementAgent"
value="true" />
<property name="openjpa.RuntimeUnenhancedClasses"
value="unsupported" />
<property name="openjpa.DataCache" value="true" />
<property name="openjpa.QueryCache" value="true" />
</properties>
</persistence-unit>
</persistence>
Thank you Romain for taking time to look at this.
br
reinis
On 01.06.2013 09:56, Romain Manni-Bucau wrote:
A sample would be great yes
Le 1 juin 2013 09:51, "Reinis Vicups" <[email protected]> a écrit :
Hi,
I bootstrap from persistence.xml that has entity definition for Permission
and NO entity definition for AbstractBaseEntity (as suggested somewhere on
forums) like this:
<entity class="my.access.Permission" />
So NO, Abstractbaseentity is not listed in persistence unit. I have tried
adding it and got different exception (something with field 'id' does not
have persistence annotations). If this is relevant I can post the exception
I get if adding AbstractBaseEntity to PU.
On 01.06.2013 09:22, Romain Manni-Bucau wrote:
Abstractbaseentity is listed in the persistence unit?
Well you can still enhance it at build time before tests
Le 31 mai 2013 23:54, "Reinis Vicups" <[email protected]> a écrit :
Hi,
I get NoSuchMethodError when testing with ApplicationComposer and
manually
supplied javaagent. When I start container (TomEE) everything works just
fine.
I enable javaagent for maven test plugin like this:
<plugin>
<groupId>org.apache.maven.****plugins</groupId>
<artifactId>maven-failsafe-****plugin</artifactId>
<version>2.14.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<groups>de.orbitx.retena.****IntegrationTest</groups>
<includes>
<include>**/*.class</include>
</includes>
<argLine>-javaagent:${project.****build.directory}/openejb-**
javaagent-${openejb.version}.****jar</argLine>
<workingDirectory>${project.****build.directory}</****workingDirectory>
</configuration>
</plugin>
javaagent is added like this (I use maven-dependency-plugin to copy it to
right place):
<dependency>
<groupId>org.apache.openejb</****groupId>
<artifactId>openejb-javaagent<****/artifactId>
<version>4.6.0-SNAPSHOT</****version>
<scope>test</scope>
</dependency>
The full log I was able to get our of openejb is here :
https://gist.github.com/****anonymous/5688204<https://gist.github.com/**anonymous/5688204>
<https://**gist.github.com/anonymous/**5688204<https://gist.github.com/anonymous/5688204>
My AbstractBaseClass looks like this:
@MappedSuperclass
public abstract class AbstractBaseEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// getter setter and so on....
}
and the Permission class from stack trace like this:
@Entity
public class Permission extends AbstractBaseEntity {
private String permission;
// more irrelevant code is here
}
I bootstrap from persistence.xml that has entity definition for
Permission
and NO entity definition for AbstractBaseEntity (as suggested somewhere
on
forums) like this:
<entity class="my.access.Permission" />
I have refactored everything couple of times (removed generics, tried to
change AbstractBaseEntity to a concrete class, moved @Id from here to
there
and now appears that the only option that I have still think of is to
remove BaseEntity.
Before I do that, I would be happy if someone could help me to avoid
that,
because this is not solution but, rather, workaround that makes my code
worse.
thank you guys for your help!
reinis