1 2 Previous Next 18 Replies Latest reply on Dec 5, 2013 10:49 AM by Ramesh Reddy

    Exception in querying data using OData

    Rakesh Balguri Expert

      Hi,

       

      I am trying to query data using OData and I get the following exception when I query data.

      I am using Teiid 8.5.

       

      Can anyone please let me know how to fix this?

       

      15 Nov 2013 12:46:03,611 IST ERROR [org.teiid.ODATA] (http-/127.0.0.1:8080-3) null TEIID16013 Error occured producing OData result.: org.teiid.core.TeiidRuntimeException: Root types must have keys

        at org.teiid.odata.ODataEntitySchemaBuilder.buildMetadata(ODataEntitySchemaBuilder.java:49) [classes:]

        at org.teiid.odata.LocalClient.getMetadata(LocalClient.java:311) [classes:]

        at org.teiid.odata.TeiidProducer.getMetadata(TeiidProducer.java:69) [classes:]

        at org.odata4j.producer.resources.EntitiesRequestResource.getEntitiesImpl(EntitiesRequestResource.java:350) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.producer.resources.EntitiesRequestResource.getEntities(EntitiesRequestResource.java:266) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_03]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_03]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_03]

        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_03]

        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.6.Final.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.6.Final.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.6.Final.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.6.Final.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.6.Final.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.6.Final.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.6.Final.jar:]

        at org.teiid.odata.ODataServletContainerDispatcher.service(ODataServletContainerDispatcher.java:97) [classes:]

        at org.teiid.odata.ODataServlet.service(ODataServlet.java:61) [classes:]

        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.6.Final.jar:]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]

      Caused by: java.lang.IllegalArgumentException: Root types must have keys

        at org.odata4j.edm.EdmEntityType.<init>(EdmEntityType.java:54) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.edm.EdmEntityType.<init>(EdmEntityType.java:33) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.edm.EdmEntityType$Builder.buildImpl(EdmEntityType.java:179) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.edm.EdmEntityType$Builder.buildImpl(EdmEntityType.java:137) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.edm.EdmType$Builder._build(EdmType.java:113) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.edm.EdmEntityType$Builder.build(EdmEntityType.java:170) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.edm.EdmSchema$Builder.build(EdmSchema.java:130) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.odata4j.edm.EdmDataServices$Builder.build(EdmDataServices.java:304) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

        at org.teiid.odata.ODataEntitySchemaBuilder.buildMetadata(ODataEntitySchemaBuilder.java:47) [classes:]

        ... 33 more

       

       

      Thanks,

      Rakesh.

        • 1. Re: Exception in querying data using OData
          Steven Hawkins Master

          Ramesh may have to weigh in here as well, but there was [TEIID-2678] Query against OData source throwing java.lang.NullPointerException - JBoss Issue Tracker which was addressed for 8.6.  Are you using a dynamic vdb or a designer vdb?  If it's a dynamic vdb then a fix beyond TEIID-2678 may be needed.  Can you provide sample metadata that is causing the issue?

           

          Steve

          • 2. Re: Exception in querying data using OData
            Ramesh Reddy Master

            Yes, looks like a metadata issue that we not encountered before. Sample VDB will help debug.

            • 3. Re: Exception in querying data using OData
              Rakesh Balguri Expert

              Hi,

               

              I am using a dynamic VDB. Our VDB is big and there are many dependencies.

              I get the same exception mentioned above when I try to query the metadata for my VDB.

              http://localhost:8080/odata/Chorus.1/$metadata

               

              I am trying to reproduce the error with the DynamicPortfolio VDB but I end up in the following error. The table I am querying contains the primary key but still teiid throws an exception. Am I  missing anything here?

               

              http://localhost:8080/odata/DynamicPortfolio.1/ACCOUNTS.PRODUCT

              Metadata for Dynamic Portfolio VDB works fine.

               

              TEIID16011 EntitySet "ACCOUNTS.PRODUCT" is not found; Check the spelling, use modelName.tableName; The table that representing the Entity type must either have a PRIMARY KEY or UNIQUE key(s)


              I tried all the combination with no luck.



              • 4. Re: Exception in querying data using OData
                Ramesh Reddy Master

                Did you see the above table in the metadata? If not as the error suggests the odata process is not finding the Primary Key on the table. If you use Squirrel to connect to the VDB, did you see the table with primary key? Turn the debug statements and it will have some messages during the vdb load. But note the original exception is completely different from this one.

                • 5. Re: Exception in querying data using OData
                  Steven Hawkins Master

                  Is any of the metadata being constructed programatically?  Is it possible that a primary key with no columns is being used?  It doesn't look like our metadata validator currently checks for that case.

                  • 6. Re: Exception in querying data using OData
                    Rakesh Balguri Expert

                    I am using the sample VDB which comes with the teiid distribution.

                    As per the .sql file, all the tables have primary keys defined but when I query the table with ODATA it throws the exception.

                     

                    Our vdb is complex so I was trying to reproduce the actual error with this sample VDB.

                     

                    Attached is the sample vdb and the .sql file.

                     

                    Thanks

                    Rakesh.

                    • 7. Re: Exception in querying data using OData
                      Ramesh Reddy Master

                      Using MySQL as database I did not see any issues as described above. Did you try on H2 or any other database?

                      • 9. Re: Exception in querying data using OData
                        Rakesh Balguri Expert

                        Hi Ramesh,

                         

                        I am using H2 database in my VDB. I tried with the URL you provided and I still get the same exception related to the Primary Key.

                        Please let me know if you need any other files related to this vdb.

                        • 10. Re: Exception in querying data using OData
                          Ramesh Reddy Master

                          I used latest 8.6 Beta version, check with this version first and then let us know if that still a problem.

                          • 11. Re: Exception in querying data using OData
                            Rakesh Balguri Expert

                            Ok, I will try with 8.6 Beta version and update.

                            • 12. Re: Exception in querying data using OData
                              Rakesh Balguri Expert

                              I tried with 8.6 Beta and using this URL http://localhost:8080/odata/Portfolio.1/Accounts.PRODUCT, I am getting a NullPointerException.

                              The following is the stack trace.

                               

                              11:53:35,191 ERROR [org.teiid.ODATA] (http-/127.0.0.1:9090-2) null TEIID16013 Error occured producing OData result.: java.lang.NullPointerException

                                      at org.teiid.odata.LocalClient.getMetadataStore(LocalClient.java:194) [classes:]

                                      at org.teiid.odata.LocalClient.getMetadata(LocalClient.java:321) [classes:]

                                      at org.teiid.odata.TeiidProducer.getMetadata(TeiidProducer.java:69) [classes:]

                                      at org.odata4j.producer.resources.EntitiesRequestResource.getEntitiesImpl(EntitiesRequestResource.java:350) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar

                              :]

                                      at org.odata4j.producer.resources.EntitiesRequestResource.getEntities(EntitiesRequestResource.java:266) [odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]

                                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_03]

                                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_03]

                                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_03]

                                      at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_03]

                                      at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at org.teiid.odata.ODataServletContainerDispatcher.service(ODataServletContainerDispatcher.java:97) [classes:]

                                      at org.teiid.odata.ODataServlet.service(ODataServlet.java:61) [classes:]

                                      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.6.Final.jar:]

                                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]

                                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Alpha1-redhat-4.j

                              ar:7.2.0.Alpha1-redhat-4]

                                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

                                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]

                               

                              Thanks

                              Rakesh

                              • 13. Re: Exception in querying data using OData
                                Ramesh Reddy Master

                                I saw same issue with [TEIID-2718] NPE During OData Access - JBoss Issue Tracker which is fixed in 8.6 Beta. Are you using Designer based VDB?

                                • 14. Re: Exception in querying data using OData
                                  Steven Hawkins Master

                                  His exception against 8.6 should only happen if the TransformationMetadata attachment is null, which it should never be as we won't let the vdb be active until it's attached.

                                  1 2 Previous Next