openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Vorburger" <mvorbur...@odyssey-group.com>
Subject Weired error "org.apache.openjpa.persistence.ArgumentException: No table was given for persistent type" due to a openjpa.jdbc.MappingDefaults problem
Date Thu, 24 Apr 2008 22:10:55 GMT
Hello,

If you specify a <property name="openjpa.jdbc.MappingDefaults"
value="ForeignKeyDeleteAction=restrict,
JoinForeignKeyDeleteAction=restrict" /> AS IS DOCUMENTED on
http://openjpa.apache.org/docs/latest/manual/ref_guide_mapping_defaults.
html you get a WEIRED error
"org.apache.openjpa.persistence.ArgumentException: No table was given
for persistent type" message (full stack trace below).  The work-around
I found is to specify <property name="openjpa.jdbc.MappingDefaults"
value="jpa(ForeignKeyDeleteAction=restrict,
JoinForeignKeyDeleteAction=restrict)" />, note the jpa(...).  This seems
logical once seen, but it's not what the doc says and what worked
earlier, and the message is really unclear here.

The released v1.0.2 didn't have this bug (?), but it is easily
reproducible, e.g. with the openjpa-examples\src\main\java\hellojpa, add
the property above into the persistence.xml, and you get the
ArgumentException on a 1.1.0-SNAPSHOT.jar built from trunk as of
29.03.2008 and from branches/1.1.x.

I tried to verify this on a 1.2.0-SNAPSHOT.jar from trunk as of today
but ran into more basic problems to get anything running on it, see at
the end.

Maybe somebody on dev would like to investigate this further... let me
know if you want me to file a JIRA.

Regards,
Michael
 
___
62  hellojpa  INFO   [main] openjpa.Runtime - Starting OpenJPA
1.1.0-SNAPSHOT
219  hellojpa  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.DerbyDictionary".
2047  hellojpa  INFO   [main] openjpa.Enhance - Creating subclass for
"[class hellojpa.Message]". This means that your application will be
less efficient and will consume more memory than it would if you ran the
OpenJPA enhancer. Additionally, lazy loading will not be available for
one-to-one and many-to-one persistent attributes in types using field
access; they will be loaded eagerly instead.
0  hellojpa  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.DerbyDictionary".
Exception in thread "main" <openjpa-1.1.0-SNAPSHOT-r422266:641891M fatal
user error> org.apache.openjpa.persistence.ArgumentException: Errors
encountered while resolving metadata.  See nested exceptions for
details.
	at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:564)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
y.java:309)
	at
org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:245)
	at
org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:216)
	at
org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:184)
	at
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClass
es(ManagedClassSubclasser.java:121)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(Abst
ractBrokerFactory.java:309)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(Abstrac
tBrokerFactory.java:227)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker
Factory.java:189)
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr
okerFactory.java:142)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:192)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:145)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:56)
	at hellojpa.Main.main(Main.java:52)
Caused by: <openjpa-1.1.0-SNAPSHOT-r422266:641891M fatal user error>
org.apache.openjpa.persistence.ArgumentException: No table was given for
persistent type "hellojpa.Message".
	at
org.apache.openjpa.jdbc.meta.MappingInfo.createTable(MappingInfo.java:43
7)
	at
org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.
java:229)
	at
org.apache.openjpa.jdbc.meta.strats.FullClassStrategy.map(FullClassStrat
egy.java:71)
	at
org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:
373)
	at
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(Ru
ntimeStrategyInstaller.java:55)
	at
org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRep
ository.java:318)
	at
org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository
.java:663)
	at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:550)
	... 13 more
NestedThrowables:
<openjpa-1.1.0-SNAPSHOT-r422266:641891M fatal user error>
org.apache.openjpa.persistence.ArgumentException: No table was given for
persistent type "hellojpa.Message".
	at
org.apache.openjpa.jdbc.meta.MappingInfo.createTable(MappingInfo.java:43
7)
	at
org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.
java:229)
	at
org.apache.openjpa.jdbc.meta.strats.FullClassStrategy.map(FullClassStrat
egy.java:71)
	at
org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:
373)
	at
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(Ru
ntimeStrategyInstaller.java:55)
	at
org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.ja
va:797)
	at
org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1626)
	at
org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataReposit
ory.java:717)
	at
org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataReposi
tory.java:678)
	at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.ja
va:556)
	at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepositor
y.java:309)
	at
org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:245)
	at
org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:216)
	at
org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:184)
	at
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClass
es(ManagedClassSubclasser.java:121)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(Abst
ractBrokerFactory.java:309)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(Abstrac
tBrokerFactory.java:227)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBroker
Factory.java:189)
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBr
okerFactory.java:142)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:192)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:145)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMana
ger(EntityManagerFactoryImpl.java:56)
	at hellojpa.Main.main(Main.java:52)


----
On a 1.2.0-SNAPSHOT.jar from trunk as of today I first got this (read on
below) :

Some product derivations are being skipped. For information about
product derivation status, run:
java org.apache.openjpa.lib.conf.ProductDerivations
Exception in thread "main" javax.persistence.PersistenceException:
Provider error. Provider:
org.apache.openjpa.persistence.PersistenceProviderImpl
	at
javax.persistence.Persistence.createFactory(Persistence.java:175)
	at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.jav
a:111)
	at hellojpa.Main.main(Main.java:42)
Caused by: <openjpa-1.2.0-SNAPSHOT-r422266:651271M fatal user error>
org.apache.openjpa.persistence.ArgumentException: Could not invoke the
static newInstance method on the named factory class
"<<openjpa-1.2.0-SNAPSHOT-r422266:651271M fatal user error>
org.apache.openjpa.util.UserException: You did not name the factory
class with the required property openjpa.BrokerFactory.  Normally this
property defaults appropriately; have you forgotten to include all the
OpenJPA jars in your classpath?>".
	at
org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:70)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(
PersistenceProviderImpl.java:102)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManag
erFactory(PersistenceProviderImpl.java:81)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManag
erFactory(PersistenceProviderImpl.java:109)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManag
erFactory(PersistenceProviderImpl.java:53)
	at
javax.persistence.Persistence.createFactory(Persistence.java:171)
	... 2 more
Caused by: <openjpa-1.2.0-SNAPSHOT-r422266:651271M fatal user error>
org.apache.openjpa.persistence.ArgumentException: You did not name the
factory class with the required property openjpa.BrokerFactory.
Normally this property defaults appropriately; have you forgotten to
include all the OpenJPA jars in your classpath?
	at
org.apache.openjpa.kernel.Bootstrap.getFactoryClass(Bootstrap.java:153)
	at
org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:111)
	at
org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:62)
	... 7 more


And after adding
-Dopenjpa.BrokerFactory=org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory
this:

Some product derivations are being skipped. For information about
product derivation status, run:
java org.apache.openjpa.lib.conf.ProductDerivations
Exception in thread "main" javax.persistence.PersistenceException:
Provider error. Provider:
org.apache.openjpa.persistence.PersistenceProviderImpl
	at
javax.persistence.Persistence.createFactory(Persistence.java:175)
	at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.jav
a:111)
	at hellojpa.Main.main(Main.java:42)
Caused by: <openjpa-1.2.0-SNAPSHOT-r422266:651271M fatal user error>
org.apache.openjpa.persistence.ArgumentException: Could not invoke the
static newInstance method on the named factory class
"org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory".
	at
org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:70)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(
PersistenceProviderImpl.java:102)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManag
erFactory(PersistenceProviderImpl.java:81)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManag
erFactory(PersistenceProviderImpl.java:109)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManag
erFactory(PersistenceProviderImpl.java:53)
	at
javax.persistence.Persistence.createFactory(Persistence.java:171)
	... 2 more
Caused by: java.lang.NoSuchMethodException:
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newInstance(org.apache.
openjpa.lib.conf.ConfigurationProvider)
	at java.lang.Class.getMethod(Unknown Source)
	at
org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:121)
	at
org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:62)
	... 7 more


____________________________________________________________

 This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
 Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
 Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
 An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
 If you have received this email in error, please notify the sender immediately
  and delete the original.

Mime
View raw message