You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by lostvicking <lo...@gmail.com> on 2013/01/28 12:52:58 UTC

MappingTool MetaDataException

Hi all,

I am trying to go through the process of forward mapping using the
MappingTool. I am using a persistence.xml and an orm.xml to do this. An
org.apache.openjpa.util.MetaDataException exception is thrown each timne I
run the MappingTool though, please advise on what steps I can take to
remedy. I run it like this, using the '-schemaAction build':

java -cp 
/home/vic/openmdx/dev/openmdx2/jre-1.6/core/lib/openmdx-base.jar:/home/vic/Downloads>
/apache-openjpa-2.2.1/src/java:/home/vic/Downloads/apache-openjpa-2.2.1/openjpa-2.2.1.jar:/home/vic/Downloads/apache-openjpa-2.2.1/openjpa-all-2.2.1.jar
org.apache.openjpa.jdbc.meta.MappingTool -p persistence.xml -schemaAction
build orm.xml

I get the following output for that, what I can not understand is that my
persistence metadata is contained inside the orm.xml file so there IS
metadata, (persistence.xml and orm.xml follow after the output log): 

31  openjpa  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.MySQLDictionary".
104  openjpa  INFO   [main] openjpa.Tool - Mapping tool running on type
"class org.test.classdiag.jpa3.Animal" with action "buildSchema".
399  openjpa  WARN   [main] openjpa.Runtime - Found no persistent property
in "org.omg.model1.jpa3.Attribute$Slice"
404  openjpa  WARN   [main] openjpa.Runtime - Found no persistent property
in "org.omg.model1.jpa3.StructureField$Slice"
432  openjpa  WARN   [main] openjpa.Runtime - Found no persistent property
in "org.omg.model1.jpa3.Reference$Slice"
446  openjpa  WARN   [main] openjpa.Runtime - Found no persistent property
in "org.omg.model1.jpa3.Parameter$Slice"
456  openjpa  WARN   [main] openjpa.Runtime - Found no persistent property
in "org.omg.model1.jpa3.Constant$Slice"
495  openjpa  WARN   [main] openjpa.Runtime - Found no persistent property
in "org.omg.model1.jpa3.Import$Slice"
506  openjpa  WARN   [main] openjpa.Runtime - Found no persistent property
in "org.omg.model1.jpa3.Constraint$Slice"
Exception in thread "main" <openjpa-2.2.1-r422266:1396819 fatal user error>
org.apache.openjpa.util.MetaDataException: Type "class
org.test.classdiag.jpa3.Animal" loaded by
sun.misc.Launcher$AppClassLoader@54f690e4 does not have persistence
metadata.
	at
org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:688)
	at
org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:754)
	at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:652)
	at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1087)
	at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1001)
	at org.apache.openjpa.jdbc.meta.MappingTool$1.run(MappingTool.java:937)
	at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:748)
	at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:738)
	at org.apache.openjpa.jdbc.meta.MappingTool.main(MappingTool.java:932)


orm.xml entry for Animal:

  <access>FIELD</access>
  <entity class="org.test.classdiag.jpa3.Animal">
    

    <inheritance strategy="JOINED"/>
    <discriminator-value>org:test:classdiag:Animal</discriminator-value>
    <discriminator-column name="DTYPE" discriminator-type="STRING"/>
    <attributes>
      <basic name="colour">
        <column name="COLOUR" nullable="true"/>
      </basic>
      <basic name="breed">
        <column name="BREED" nullable="true"/>
      </basic>
      <basic name="name">
        <column name="NAME" nullable="true"/>
      </basic>
      <one-to-many name="openmdxjdoSlices" mapped-by="openmdxjdoIdentity">
        <map-key name="openmdxjdoIndex"/>
      </one-to-many>
    </attributes>
  </entity>


persistence.xml:
<?xml version="1.0"?>
<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="openjpa"  transaction-type="RESOURCE_LOCAL">
	
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
		 <class>org.test.classdiag.jpa3.Animal</class>
                 <class>org.test.classdiag.jpa3.Cat</class>
                 <class>org.test.classdiag.jpa3.Dog</class>

		<properties>
			<property name="openjpa.Log" value="SQL=INFO"/>
			
			<property name="openjpa.jdbc.MappingDefaults"
value="IndexLogicalForeignKeys=false,IndexDiscriminator=false"/>
			<property name="openjpa.ConnectionURL"
value="jdbc:mysql://localhost:3306/TEST_OPENMDX"/>
			<property name="openjpa.ConnectionDriverName"
value="com.mysql.jdbc.Driver"/>
			<property name="openjpa.ConnectionUserName" value="root"/>
			<property name="openjpa.ConnectionPassword" value="root"/>
		</properties>
	</persistence-unit>
</persistence>




--
View this message in context: http://openjpa.208410.n2.nabble.com/MappingTool-MetaDataException-tp7582647.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.