2 Replies Latest reply on May 12, 2009 7:00 PM by Ben Truitt

    UnresolvedReferenceException in JDBC metadata

    Ben Truitt Newbie

      Hi -
      I am new to Teiid, and I'm really excited to dig in. I'm encountering an issue when importing a JDBC source and could use your help diagnosing the issue.

      I am using the Designer on Version: 3.5.0 M7 (Build id: I20090430-2300), java.runtime.version=1.6.0_07-b06-153, on mac os x version 10.5.6.

      I am trying to import a JDBC metadata source from Postgresql 8.2, using driver postgresql-8.2-507.jdbc3.jar.

      I am able to successfully import at least one table from this database. However, another table is giving me trouble. I am including the source xmi file that is generated by the import process. This file has a number of problems reported, all of which involve "org.eclipse.emf.ecore.xmi.UnresolvedReferenceException" exceptions.

      My guess is that the mixed-case in the table, column and index names is causing trouble, but I am not sure if I'm right about that. I'm basing that on the fact that the table that I have imported successfully has only lowercase table and column names.

      Here is a full stack trace of one of these exceptions:

      org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.UnresolvedReferenceException: Unresolved reference 'mmuuid/dd13aef3-8dc6-44a4-89b2-eecf24cfaef4'. (platform:/resource/ModelTest/core_dev_source.xmi, 8, 170)
       at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
       at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
       at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
       at org.eclipse.emf.ecore.presentation.EcoreEditor.createModelGen(EcoreEditor.java:1067)
       at org.eclipse.emf.ecore.presentation.EcoreEditor.createModel(EcoreEditor.java:1087)
       at org.eclipse.emf.ecore.presentation.EcoreEditor.createPages(EcoreEditor.java:1152)
       at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:357)
       at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:659)
       at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:459)
       at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
       at org.eclipse.ui.internal.EditorReference.getPart(EditorReference.java:821)
       at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:283)
       at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2857)
       at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
       at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
       at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
       at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
       at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
       at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
       at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:344)
       at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:192)
       at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
       at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3524)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1247)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1270)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1255)
       at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1076)
       at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3422)
       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3081)
       at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
       at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
       at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
       at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
       at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
       at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
       at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
       at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
       at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
       at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
       at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
       at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
       at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
       at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
       at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
      Caused by: org.eclipse.emf.ecore.xmi.UnresolvedReferenceException: Unresolved reference 'mmuuid/dd13aef3-8dc6-44a4-89b2-eecf24cfaef4'. (platform:/resource/ModelTest/core_dev_source.xmi, 8, 170)
       at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardReferences(XMLHandler.java:1140)
       at org.eclipse.emf.ecore.xmi.impl.XMLHandler.endDocument(XMLHandler.java:1214)
       at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:737)
       at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:515)
       at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
       at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
       at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
       at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
       at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
       at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
       at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:181)
       at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:180)
       at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1445)
       at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1241)
       at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
       at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
       ... 47 more


      Here is the generated source file that results in many such exceptions. Note, to protect the innocent, names have been changed, and some content has been ommitted.

      <?xml version="1.0" encoding="ASCII"?>
      <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:diagram="http://www.metamatrix.com/metamodels/Diagram" xmlns:jdbc="http://www.metamatrix.com/metamodels/JDBC" xmlns:mmcore="http://www.metamatrix.com/metamodels/Core" xmlns:relational="http://www.metamatrix.com/metamodels/Relational">
       <mmcore:ModelAnnotation xmi:uuid="mmuuid:7cd31063-0a89-4725-93ea-c509b190263b" primaryMetamodelUri="http://www.metamatrix.com/metamodels/Relational" modelType="PHYSICAL" ProducerName="Teiid Designer" ProducerVersion="6.0">
       <modelImports xmi:uuid="mmuuid:144403e0-2acc-4d66-afbf-88f185e8413d" name="SimpleDatatypes-instance" modelLocation="http://www.metamatrix.com/metamodels/SimpleDatatypes-instance" modelType="TYPE" primaryMetamodelUri="http://www.eclipse.org/xsd/2002/XSD"/>
       <modelImports xmi:uuid="mmuuid:93d16619-2df7-43b3-a5f8-ef504f104433" name="XMLSchema" modelLocation="http://www.w3.org/2001/XMLSchema" modelType="TYPE" primaryMetamodelUri="http://www.eclipse.org/xsd/2002/XSD"/>
       </mmcore:ModelAnnotation>
       <mmcore:AnnotationContainer xmi:uuid="mmuuid:a0e7d8e6-c0f0-4f04-9250-ab629e543103">
       <annotations xmi:uuid="mmuuid:2d85def2-7014-4708-ba53-3c93176381de" description="details_ommitted" annotatedObject="mmuuid/dd13aef3-8dc6-44a4-89b2-eecf24cfaef4"/>
       <annotations xmi:uuid="mmuuid:909fdb32-1b0b-4c6b-bfd7-4993b3a2c1c6" description="details_ommitted" annotatedObject="mmuuid/60ca6842-d8fa-49e3-a2b7-d5e465248d99"/>
       <annotations xmi:uuid="mmuuid:11b134a4-f391-4b70-88a4-3f56fada2230" description="details_ommitted" annotatedObject="mmuuid/133ec7e1-aebe-455e-97b4-627cf2f5cd37"/>
       <annotations xmi:uuid="mmuuid:65653054-8a9b-40c9-8359-2280709a9c93" description="details_ommitted" annotatedObject="mmuuid/53e4e733-7c98-4793-8e92-d00dde719360"/>
       <annotations xmi:uuid="mmuuid:97d76354-65ec-4e57-9349-64f12ecc0627" description="details_ommitted" annotatedObject="mmuuid/3cb72dd8-b23b-4f2b-ab7a-6a1c768e9ef7"/>
       <annotations xmi:uuid="mmuuid:9ee3ff85-a7f7-476e-ad32-a5e2ef0e3323" description="details_ommitted" annotatedObject="mmuuid/97540f85-70d4-41fb-9213-58319ba571f6"/>
       </mmcore:AnnotationContainer>
       <relational:Schema xmi:uuid="mmuuid:3ccfbcc3-ef97-48c8-877f-36c9a32a20b7" name="public" nameInSource=""public"">
       <tables xsi:type="relational:BaseTable" xmi:uuid="mmuuid:dd13aef3-8dc6-44a4-89b2-eecf24cfaef4" name="ACCT_Account" nameInSource=""ACCT_Account"" cardinality="36920">
       <columns xmi:uuid="mmuuid:60ca6842-d8fa-49e3-a2b7-d5e465248d99" name="ID" nameInSource=""ID"" nativeType="serial" fixedLength="true" precision="10" nullable="NO_NULLS" defaultValue="nextval('"ACCT_Account_ID_seq"'::regclass)" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" uniqueKeys="mmuuid/966b6365-bde9-4130-8bad-17503bebe418">
       <type href="http://www.w3.org/2001/XMLSchema#int"/>
       </columns>
       <columns xmi:uuid="mmuuid:133ec7e1-aebe-455e-97b4-627cf2f5cd37" name="AccountNumber" nameInSource=""AccountNumber"" nativeType="varchar" length="10" nullable="NO_NULLS" indexes="mmuuid/721200d1-8e9b-4729-a3b0-370d077869af">
       <type href="http://www.w3.org/2001/XMLSchema#string"/>
       </columns>
       <columns xmi:uuid="mmuuid:53e4e733-7c98-4793-8e92-d00dde719360" name="ACCT_val_AccountTypeID" nameInSource=""ACCT_val_AccountTypeID"" nativeType="int4" fixedLength="true" precision="10" nullable="NO_NULLS" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" foreignKeys="mmuuid/66178a22-4891-476f-952c-c3cd79e46552">
       <type href="http://www.w3.org/2001/XMLSchema#int"/>
       </columns>
       <columns xmi:uuid="mmuuid:3cb72dd8-b23b-4f2b-ab7a-6a1c768e9ef7" name="ACCT_val_SLATypeID" nameInSource=""ACCT_val_SLATypeID"" nativeType="int4" fixedLength="true" precision="10" nullable="NO_NULLS" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" foreignKeys="mmuuid/f816dbf6-bc42-4363-a3ac-82bc47904c5b">
       <type href="http://www.w3.org/2001/XMLSchema#int"/>
       </columns>
       <columns xmi:uuid="mmuuid:97540f85-70d4-41fb-9213-58319ba571f6" name="Created" nameInSource=""Created"" nativeType="timestamptz" fixedLength="true" precision="35" scale="6" nullable="NO_NULLS" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
       <type href="http://www.metamatrix.com/metamodels/SimpleDatatypes-instance#timestamp"/>
       </columns>
       <columns xmi:uuid="mmuuid:e4771d8c-40c1-4730-a126-cdfca8fee297" name="EmergencyInstructions" nameInSource=""EmergencyInstructions"" nativeType="text" length="2147483647" defaultValue="''::text">
       <type href="http://www.w3.org/2001/XMLSchema#string"/>
       </columns>
       <columns xmi:uuid="mmuuid:6b0b5eaf-ce12-4ac9-90d3-3c9e1c99eb4a" name="crm_company_id" nameInSource=""crm_company_id"" nativeType="int4" fixedLength="true" precision="10" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" indexes="mmuuid/2d4c8c89-e846-45ca-9512-cb93d2fb09ff">
       <type href="http://www.w3.org/2001/XMLSchema#int"/>
       </columns>
       <columns xmi:uuid="mmuuid:120cbc15-4b28-4371-82d0-1dd3ba94abc8" name="ACCT_TeamID" nameInSource=""ACCT_TeamID"" nativeType="int4" fixedLength="true" precision="10" nullable="NO_NULLS" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" foreignKeys="mmuuid/973cbbf8-e7e0-496e-b198-29575564ab44">
       <type href="http://www.w3.org/2001/XMLSchema#int"/>
       </columns>
       <columns xmi:uuid="mmuuid:13094693-91cc-443c-942e-fb4a6c6fb4ea" name="creation_date" nameInSource=""creation_date"" nativeType="timestamp" fixedLength="true" precision="29" scale="6" defaultValue="now()" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" indexes="mmuuid/c191b656-7cd3-4d11-9e10-24e32c49682f">
       <type href="http://www.metamatrix.com/metamodels/SimpleDatatypes-instance#timestamp"/>
       </columns>
       <columns xmi:uuid="mmuuid:81e72f54-42d8-4e6c-80e8-e9f48a6c05fe" name="modification_date" nameInSource=""modification_date"" nativeType="timestamp" fixedLength="true" precision="29" scale="6" defaultValue="now()" caseSensitive="false" searchability="ALL_EXCEPT_LIKE" indexes="mmuuid/13e80e6b-9a1f-4337-8e82-4a4815ab2218">
       <type href="http://www.metamatrix.com/metamodels/SimpleDatatypes-instance#timestamp"/>
       </columns>
       <columns xmi:uuid="mmuuid:17b025f1-9d77-468b-bfbd-be3b97f849f0" name="details_ommitted" nameInSource=""email_security"" nativeType="int4" fixedLength="true" precision="10" defaultValue="2" caseSensitive="false" searchability="ALL_EXCEPT_LIKE">
       <type href="http://www.w3.org/2001/XMLSchema#int"/>
       </columns>
       <foreignKeys xmi:uuid="mmuuid:973cbbf8-e7e0-496e-b198-29575564ab44" name="x" nameInSource=""$5"" foreignKeyMultiplicity="UNSPECIFIED" primaryKeyMultiplicity="UNSPECIFIED" columns="mmuuid/120cbc15-4b28-4371-82d0-1dd3ba94abc8"/>
       <foreignKeys xmi:uuid="mmuuid:f816dbf6-bc42-4363-a3ac-82bc47904c5b" name="x1" nameInSource=""$1"" foreignKeyMultiplicity="UNSPECIFIED" primaryKeyMultiplicity="UNSPECIFIED" columns="mmuuid/3cb72dd8-b23b-4f2b-ab7a-6a1c768e9ef7"/>
       <foreignKeys xmi:uuid="mmuuid:66178a22-4891-476f-952c-c3cd79e46552" name="x2" nameInSource=""$2"" foreignKeyMultiplicity="UNSPECIFIED" primaryKeyMultiplicity="UNSPECIFIED" columns="mmuuid/53e4e733-7c98-4793-8e92-d00dde719360"/>
       <primaryKey xmi:uuid="mmuuid:966b6365-bde9-4130-8bad-17503bebe418" name="ACCT_Account_pkey" nameInSource=""ACCT_Account_pkey"" columns="mmuuid/60ca6842-d8fa-49e3-a2b7-d5e465248d99"/>
       </tables>
       <indexes xmi:uuid="mmuuid:721200d1-8e9b-4729-a3b0-370d077869af" name="AccountNumber_unique_index" nameInSource=""ACCT_Account"" unique="true" columns="mmuuid/133ec7e1-aebe-455e-97b4-627cf2f5cd37"/>
       <indexes xmi:uuid="mmuuid:2d4c8c89-e846-45ca-9512-cb93d2fb09ff" name="ACCT_Account_crm_id" nameInSource=""ACCT_Account"" unique="true" columns="mmuuid/6b0b5eaf-ce12-4ac9-90d3-3c9e1c99eb4a"/>
       <indexes xmi:uuid="mmuuid:c191b656-7cd3-4d11-9e10-24e32c49682f" name="ACCT_Account_creation_date" nameInSource=""ACCT_Account"" unique="true" columns="mmuuid/13094693-91cc-443c-942e-fb4a6c6fb4ea"/>
       <indexes xmi:uuid="mmuuid:13e80e6b-9a1f-4337-8e82-4a4815ab2218" name="ACCT_Account_modification_date" nameInSource=""ACCT_Account"" unique="true" columns="mmuuid/81e72f54-42d8-4e6c-80e8-e9f48a6c05fe"/>
       </relational:Schema>
       <diagram:DiagramContainer xmi:uuid="mmuuid:7a163d55-c34e-4d73-ba19-98e996893baa"/>
       <jdbc:JdbcSource xmi:uuid="mmuuid:55da9069-0fcf-45c6-9943-b63f7deab4c1" name="core_dev source" driverName="PostgreSQL" driverClass="org.postgresql.Driver" username="details_ommitted" url="jdbc:postgresql://details_ommitted:5432/details_ommitted">
       <importSettings xmi:uuid="mmuuid:180e150e-f6bb-4940-b13b-104290833ffc">
       <includedSchemaPaths>/public</includedSchemaPaths>
       <excludedObjectPaths>/public/TABLE/many_tables_ommitted_here</excludedObjectPaths>
       <includedTableTypes>INDEX</includedTableTypes>
       <includedTableTypes>SEQUENCE</includedTableTypes>
       <includedTableTypes>SYSTEM INDEX</includedTableTypes>
       <includedTableTypes>SYSTEM TABLE</includedTableTypes>
       <includedTableTypes>SYSTEM TOAST INDEX</includedTableTypes>
       <includedTableTypes>SYSTEM TOAST TABLE</includedTableTypes>
       <includedTableTypes>SYSTEM VIEW</includedTableTypes>
       <includedTableTypes>TABLE</includedTableTypes>
       <includedTableTypes>TEMPORARY INDEX</includedTableTypes>
       <includedTableTypes>TEMPORARY TABLE</includedTableTypes>
       <includedTableTypes>VIEW</includedTableTypes>
       </importSettings>
       </jdbc:JdbcSource>
      </xmi:XMI>


      Looking forward to hearing your ideas for how to fix this!
      Ben Truitt