java.lang.NoSuchMethodError: ....AggregationEntity.pcGetManagedFieldCount()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.NoSuchMethodError: ....AggregationEntity.pcGetManagedFieldCount()

uwe_pachler
Hi,

I'm facing a nasty issue with my freshly refactored entity class hierarchy (things did work before):

openjpa.MetaData - The class "com.mycompany.FamilyAggregationEntity" listed in the openjpa.MetaDataFactory configuration property could not be loaded by org.apache.openejb.arquillian.openejb.SWClassLoader@5b408dc3; ignoring.
2091  corbox_appgateway  TRACE  [main] openjpa.MetaData - java.lang.NoSuchMethodError: de.datagroup.corbox.appgateway.bizimpl.db.entities.AggregationEntity.pcGetManagedFieldCount()Ijava.lang.NoSuchMethodError: de.datagroup.corbox.appgateway.bizimpl.db.entities.AggregationEntity.pcGetManagedFieldCount()I
        at de.datagroup.corbox.appgateway.bizimpl.db.entities.ManagedCustomersFamilyAggregationEntity.<clinit>(ManagedCustomersFamilyAggregationEntity.java)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1559)
        at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1535)
        at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1513)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:279)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:235)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:211)
        at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
        at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:178)
        at org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:130)
        at org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:145)
        at org.apache.openejb.persistence.JtaEntityManager.typedProxyIfNoTx(JtaEntityManager.java:382)
        at org.apache.openejb.persistence.JtaEntityManager.createNamedQuery(JtaEntityManager.java:430)

The entity class in question does appear in the list printed by OpenJPA  as 'persistend type name' before the exception happens:

2043  corbox_appgateway  TRACE  [main] openjpa.MetaData - parsePersistentTypeNames() found [... com.mycompany.FamilyAggregationEntity ...]

I have a hierarchy of entity classes, like this:

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class AggregationEntity implements Aggregation, Serializable {
..
}

@Entity
@Table(name="...")
@NamedQueries({
...
})
public class FamilyAggregationEntity extends AggregationEntity {
..
}

There are other entity subclasses of AggregationEntity, and these were present and working before adding FamilyAggregationEntity..

I also tried @MappedSuperclass on AggregationEntity instead of @Entity/@Inheritance (which is probably better JPA-standards-wise), but that didn't help either...

Any ideas greatly appreciated.

Thanks,

Uwe

Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NoSuchMethodError: ....AggregationEntity.pcGetManagedFieldCount()

Mark Struberg-3
Maybe you have an import of a class which doesn't exist?

Did you try to debug into and do a Class.forName in the debugger?
It also might be something missing by the annotations.

Just a first guess.

LIeGrue,
strub


> Am 03.02.2017 um 20:17 schrieb Pachler, Uwe <[hidden email]>:
>
> Hi,
>
> I'm facing a nasty issue with my freshly refactored entity class hierarchy (things did work before):
>
> openjpa.MetaData - The class "com.mycompany.FamilyAggregationEntity" listed in the openjpa.MetaDataFactory configuration property could not be loaded by org.apache.openejb.arquillian.openejb.SWClassLoader@5b408dc3; ignoring.
> 2091  corbox_appgateway  TRACE  [main] openjpa.MetaData - java.lang.NoSuchMethodError: de.datagroup.corbox.appgateway.bizimpl.db.entities.AggregationEntity.pcGetManagedFieldCount()Ijava.lang.NoSuchMethodError: de.datagroup.corbox.appgateway.bizimpl.db.entities.AggregationEntity.pcGetManagedFieldCount()I
> at de.datagroup.corbox.appgateway.bizimpl.db.entities.ManagedCustomersFamilyAggregationEntity.<clinit>(ManagedCustomersFamilyAggregationEntity.java)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:348)
> at org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1559)
> at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1535)
> at org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1513)
> at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:279)
> at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:235)
> at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:211)
> at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)
> at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
> at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
> at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:178)
> at org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:130)
> at org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:145)
> at org.apache.openejb.persistence.JtaEntityManager.typedProxyIfNoTx(JtaEntityManager.java:382)
> at org.apache.openejb.persistence.JtaEntityManager.createNamedQuery(JtaEntityManager.java:430)
>
> The entity class in question does appear in the list printed by OpenJPA  as 'persistend type name' before the exception happens:
>
> 2043  corbox_appgateway  TRACE  [main] openjpa.MetaData - parsePersistentTypeNames() found [... com.mycompany.FamilyAggregationEntity ...]
>
> I have a hierarchy of entity classes, like this:
>
> @Entity
> @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
> public abstract class AggregationEntity implements Aggregation, Serializable {
> ..
> }
>
> @Entity
> @Table(name="...")
> @NamedQueries({
> ...
> })
> public class FamilyAggregationEntity extends AggregationEntity {
> ..
> }
>
> There are other entity subclasses of AggregationEntity, and these were present and working before adding FamilyAggregationEntity..
>
> I also tried @MappedSuperclass on AggregationEntity instead of @Entity/@Inheritance (which is probably better JPA-standards-wise), but that didn't help either...
>
> Any ideas greatly appreciated.
>
> Thanks,
>
> Uwe
>

Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NoSuchMethodError: ....AggregationEntity.pcGetManagedFieldCount()

uwe_pachler
In reply to this post by uwe_pachler
Hi Mark,

No, the class exists, and the annotations apparently were fine as well - I could resolve this issue, but the solution is as weird as the issue itself:

I used to have a subset of classes present in my persistence.xml (assume there are entities A-Z, and A-C were listed in persistence.xml). However scanning was not turned off, so OpenJPA would deal with both sets (and presumably merge them). In fact, those few entity classes listed in persistence.xml were an oversight on my part, as I rely on scanning for entity classes for the application.

After frusttrating long hours I finally discovered those remaining listed classes and removed them from persistence.xml - and that made it work...

No idea why that would cause a problem, but apparently it did, and only after adding another entity.. I can only speculate about what the reasons were, maybe there is interference with OpenJPA's runtime class enhancement (I'm not using build-time enhancement so the built app is not bound to OpenJPA).

Sorry I can't be more specific, I'm just glad it's resolved now..

Cheers,

Uwe