1 2 Previous Next 23 Replies Latest reply on Feb 3, 2017 9:54 AM by Ramesh Reddy

    java.lang.IllegalArgumentException: type cannot be null in translator-odata

    Amit Singh Newbie

      Hi ,

      I am using teiid odata and ws libraries to for making a SAP Odata connector. I am able to create a connection and get all the properties for a SAP entity. But while trying to fetch the records I get the following exception

       

      jvm 1    | ERROR [PROCESSOR] TEIID30019 Unexpected exception for request Mg/70YoK2pYp.17

      jvm 1    | java.lang.IllegalArgumentException: type cannot be null

      jvm 1    |      at org.odata4j.edm.EdmDataServices.getEdmEntitySet(EdmDataServices.java:61)

      jvm 1    |      at org.odata4j.internal.EdmDataServicesDecorator.getEdmEntitySet(EdmDataServicesDecorator.java:41)

      jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:366)

      jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:168)

      jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:156)

      jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:44)

      jvm 1    |      at org.teiid.translator.odata.BaseQueryExecution.parse(BaseQueryExecution.java:91)

      jvm 1    |      at org.teiid.translator.odata.BaseQueryExecution.executeWithReturnEntity(BaseQueryExecution.java:123)

      jvm 1    |      at org.teiid.translator.odata.ODataQueryExecution.execute(ODataQueryExecution.java:100)

      jvm 1    |      at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:359)

      jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      jvm 1    |      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      jvm 1    |      at java.lang.reflect.Method.invoke(Method.java:483)

      jvm 1    |      at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)

      jvm 1    |      at com.sun.proxy.$Proxy272.execute(Unknown Source)

      jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)

      jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)

      jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)

      jvm 1    |      at java.util.concurrent.FutureTask.run(FutureTask.java:266)

      jvm 1    |      at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)

      jvm 1    |      at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)

      jvm 1    |      at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)

      jvm 1    |      at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)

      jvm 1    |      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

      jvm 1    |      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

      jvm 1    |      at java.lang.Thread.run(Thread.java:745)

       

      I have checked the URI getting build up at run time and when I hit the same using postman , its returning results.

       

      This is my Entity

      <EntityType Name="Account" sap:content-version="1">

                      <Key>

                          <PropertyRef Name="accountID"/>

                      </Key>

                      <Property Name="accountID" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="BusinessPartner"/>

                      <Property Name="name1" Type="Edm.String" MaxLength="40" sap:label="Name 1"/>

                      <Property Name="isMyAccount" Type="Edm.Boolean" sap:label="TRUE"/>

      </EntityType>

       

       

      Any idea why its failing??

        • 2. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
          Ramesh Reddy Master

          Do you know if SAP service is OData V2 or V4? if SAP service is V2 there is separate translator in Teiid for that. It is by name "sap-gateway". The translator you are using is OData V4, I can't say that I have tested this SAP, as at the time this was developed there was no SAP V4 service.

           

          Ramesh..

          • 3. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
            Amit Singh Newbie

            Hi Ramesh,

             

            You are right we are using version 2

            It is version 2.0.

             

             

            Can you just help me here ....which translator to use . Also does these libraries will also have an impact

            <dependency>

                        <groupId>org.jboss.oreva</groupId>

                        <artifactId>odata-core</artifactId>

            <version>1.0.0</version>

                    </dependency>

                    <dependency>

                        <groupId>org.jboss.oreva</groupId>

                        <artifactId>common</artifactId>

            <version>1.0.0</version>

                    </dependency>

            • 5. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
              Amit Singh Newbie

              Hi ,

               

              I am using the same dependencies as said above. Also I am using translator-odata in connectors. And the specific translator in that which I am using is SAPNWODataExecutionFactory, even I tried SAPODataExecutionFactory too (there is no diff as previous extends this one).

               

              I checked on SAP demo systems for the Odata services, even they are on the V2.

              https://sapes4.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/$metadata

               

              And when I tried to fetch the records from that service , it gave the same exception.

              • 6. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                Ramesh Reddy Master

                it is a different code base, it MUST be a different exception stack and can not be same. If you still seeing exactly same then you have not configured correctly. If you did please post the new exception.

                • 7. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                  Amit Singh Newbie

                  Sorry for not posting the exception ...........Here you go

                   

                  jvm 1    | java.lang.IllegalArgumentException: type cannot be null

                  jvm 1    |      at org.odata4j.edm.EdmDataServices.getEdmEntitySet(EdmDataServices.java:61)

                  jvm 1    |      at org.odata4j.internal.EdmDataServicesDecorator.getEdmEntitySet(EdmDataServicesDecorator.java:41)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:412)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:173)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:161)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:49)

                  jvm 1    |      at org.teiid.translator.odata.BaseQueryExecution.parse(BaseQueryExecution.java:91)

                  jvm 1    |      at org.teiid.translator.odata.BaseQueryExecution.executeWithReturnEntity(BaseQueryExecution.java:123)

                  jvm 1    |      at org.teiid.translator.odata.ODataQueryExecution.execute(ODataQueryExecution.java:100)

                  jvm 1    |      at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:359)

                  jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

                  jvm 1    |      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                  jvm 1    |      at java.lang.reflect.Method.invoke(Method.java:483)

                  jvm 1    |      at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)

                  jvm 1    |      at com.sun.proxy.$Proxy272.execute(Unknown Source)

                  jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)

                  jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)

                  jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)

                  jvm 1    |      at java.util.concurrent.FutureTask.run(FutureTask.java:266)

                  jvm 1    |      at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)

                  jvm 1    |      at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)

                  jvm 1    |      at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)

                  jvm 1    |      at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)

                  jvm 1    |      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                  jvm 1    |      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                  jvm 1    |      at java.lang.Thread.run(Thread.java:745)

                  jvm 1    | ERROR [PROCESSOR] TEIID30019 Unexpected exception for request DbhuylR3s8oZ.6

                  jvm 1    | java.lang.IllegalArgumentException: type cannot be null

                  jvm 1    |      at org.odata4j.edm.EdmDataServices.getEdmEntitySet(EdmDataServices.java:61)

                  jvm 1    |      at org.odata4j.internal.EdmDataServicesDecorator.getEdmEntitySet(EdmDataServicesDecorator.java:41)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:412)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:173)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:161)

                  jvm 1    |      at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:49)

                  jvm 1    |      at org.teiid.translator.odata.BaseQueryExecution.parse(BaseQueryExecution.java:91)

                  jvm 1    |      at org.teiid.translator.odata.BaseQueryExecution.executeWithReturnEntity(BaseQueryExecution.java:123)

                  jvm 1    |      at org.teiid.translator.odata.ODataQueryExecution.execute(ODataQueryExecution.java:100)

                  jvm 1    |      at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:359)

                  jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

                  jvm 1    |      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                  jvm 1    |      at java.lang.reflect.Method.invoke(Method.java:483)

                  jvm 1    |      at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)

                  jvm 1    |      at com.sun.proxy.$Proxy272.execute(Unknown Source)

                  jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)

                  jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)

                  jvm 1    |      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)

                  • 8. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                    Ramesh Reddy Master

                    Amit,

                     

                    Is above SAP service a public service, that I can hit to reproduce the issue? it seems to be asking for user/password. Is there a place I can register to access this service? Or if there is way you can attach the $metadata file, then also I can debug to see what is the issue?

                     

                    Thanks

                     

                    Ramesh..

                    • 9. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                      Amit Singh Newbie

                      Yes please use the below credentials....which I will reset later

                       

                      User is : s0010558389

                       

                      Password : pitney@1

                      • 10. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                        Ramesh Reddy Master

                        Thanks. I could connect to the above URL with supplied credentials and issue commands like

                         

                        select * from BusinessPartnerSet
                        select * from ProductSet
                        

                         

                        with no issues. There is no Accounts EntityType in that $metadata. Can you post the query that exhibits this behavior on this service?


                        Ramesh..

                        • 11. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                          Amit Singh Newbie

                          Hi,

                           

                          URI getting hit in the code is

                          BusinessPartnerSet?$select=Address,BusinessPartnerID,CompanyName,WebAddress,EmailAddress,PhoneNumber,FaxNumber,LegalForm,CurrencyCode,BusinessPartnerRole,CreatedAt,ChangedAt&$top=50

                           

                          I debugged the code and its the same here

                          BinaryWSProcedureExecution execution = executeDirect(method, uri, payload, headers);

                            for (Status status:expectedStatus) {

                            if (status.getStatusCode() == execution.getResponseCode()) {

                            if (execution.getResponseCode() != Status.NO_CONTENT.getStatusCode()

                            && execution.getResponseCode() != Status.NOT_FOUND.getStatusCode()) {

                            Blob blob = (Blob)execution.getOutputParameterValues().get(0);

                            ODataVersion version = getODataVersion(execution);

                            Feed feed = parse(blob, version, entityTable, edsMetadata);

                            return new ODataEntitiesResponse(uri, feed, entityTable, edsMetadata);

                            }

                            // this is success with no-data

                            return new ODataEntitiesResponse();

                            }

                            }

                           

                          While parsing the result exception is coming

                          • 12. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                            Ramesh Reddy Master

                            Now that is a new from what you had before

                             

                            You are consuming from SAP OData  V2 service, and querying over OData V2 or V4 on Teiid. The issue above, what I can tell you is, you are trying to execute the OData query you formed for direct SAP OData interface on Teiid. That will not work always. Like in this case the the Address in the original SAP service is a complex property of the BusinessParterSet, when that metadata is brought into Teiid (which is like relational database engine) it does not handle complex objects, so it has to either inline the properties of the "address" complex object or it has to define as a separate table with defined relationships. So, that is what Teiid does, in this case it inlines "address" specific columns into BusinessParterSet. Another reason we do this is, on Teiid we have to be able to also able to

                             

                            select * from BusinessPartnerSet
                            

                             

                            results in tabular format, Address as a complex object (blob/clob) does not convey the right decipher of the information fully. so try like

                             

                            http://localhost:8080/odata4/sap/sap/BusinessPartnerSet?$select=Address_City,Address_PostalCode,BusinessPartnerID,Compan…

                             

                            I just realized this is one way to convert a V2 service into V4 without any coding.

                             

                            Ramesh..

                            • 13. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                              Amit Singh Newbie

                              Hi,

                               

                              I am not sure if I got you completely  , but the same exception came when I executed on the below service.

                               

                              This is meta data for the service

                              <?xml version="1.0" encoding="utf-8"?>

                              <edmx:Edmx Version="1.0"

                                  xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"

                                  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

                                  xmlns:sap="http://www.sap.com/Protocols/SAPData">

                                  <edmx:DataServices m:DataServiceVersion="2.0">

                                      <Schema Namespace="Z_TRAVELAGENCY_SRV" xml:lang="en"

                                          xmlns="http://schemas.microsoft.com/ado/2008/09/edm">

                                          <EntityType Name="Stravelag" sap:content-version="1">

                                              <Key>

                                                  <PropertyRef Name="Agencynum"/>

                                              </Key>

                                              <Property Name="Currency" Type="Edm.String" MaxLength="5" sap:label="Trav.Agency.Curr" sap:semantics="currency-code"/>

                                              <Property Name="Langu" Type="Edm.String" MaxLength="1" sap:label="Language"/>

                                              <Property Name="Url" Type="Edm.String" MaxLength="255" sap:label="Travel agency URL"/>

                                              <Property Name="Telephone" Type="Edm.String" MaxLength="30" sap:label="Tel."/>

                                              <Property Name="Region" Type="Edm.String" MaxLength="3" sap:label="Region"/>

                                              <Property Name="Country" Type="Edm.String" MaxLength="3" sap:label="Country"/>

                                              <Property Name="Agencynum" Type="Edm.String" Nullable="false" MaxLength="8" sap:label="Agency No." sap:updatable="false"/>

                                              <Property Name="Name" Type="Edm.String" MaxLength="25" sap:label="Travel agency name"/>

                                              <Property Name="City" Type="Edm.String" MaxLength="25" sap:label="City"/>

                                              <Property Name="Street" Type="Edm.String" MaxLength="30" sap:label="Street"/>

                                              <Property Name="Postbox" Type="Edm.String" MaxLength="10" sap:label="PO Box"/>

                                              <Property Name="Postcode" Type="Edm.String" MaxLength="10" sap:label="Postal Code"/>

                                          </EntityType>

                                          <EntityContainer Name="Z_TRAVELAGENCY_SRV" m:IsDefaultEntityContainer="true">

                                              <EntitySet Name="TravelAgencySet" EntityType="Z_TRAVELAGENCY_SRV.Stravelag" sap:searchable="true" sap:content-version="1"/>

                                          </EntityContainer>

                                          <atom:link rel="self" href="http://crm-qa-ehp3.pbi.global.pvt:8000/sap/opu/odata/sap/Z_TRAVELAGENCY_SRV/$metadata"

                                              xmlns:atom="http://www.w3.org/2005/Atom"/>

                                              <atom:link rel="latest-version" href="http://crm-qa-ehp3.pbi.global.pvt:8000/sap/opu/odata/sap/Z_TRAVELAGENCY_SRV/$metadata"

                                                  xmlns:atom="http://www.w3.org/2005/Atom"/>

                                              </Schema>

                                          </edmx:DataServices>

                                      </edmx:Edmx>

                               

                              And this is the data for which I got the same exception , where I don't see complex objects.

                               

                              <?xml version="1.0" encoding="utf-8"?>

                              <feed xml:base="http://crm-qa-ehp3.pbi.global.pvt:8000/sap/opu/odata/sap/Z_TRAVELAGENCY_SRV/"

                                  xmlns="http://www.w3.org/2005/Atom"

                                  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

                                  xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">

                                  <id>http://crm-qa-ehp3.pbi.global.pvt:8000/sap/opu/odata/sap/Z_TRAVELAGENCY_SRV/TravelAgencySet</id>

                                  <title type="text">TravelAgencySet</title>

                                  <updated>2017-02-01T18:20:02Z</updated>

                                  <author>

                                      <name/>

                                  </author>

                                  <link href="TravelAgencySet" rel="self" title="TravelAgencySet"/>

                                  <entry>

                                      <id>http://crm-qa-ehp3.pbi.global.pvt:8000/sap/opu/odata/sap/Z_TRAVELAGENCY_SRV/TravelAgencySet('10000001')</id>

                                      <title type="text">TravelAgencySet('10000001')</title>

                                      <updated>2017-02-01T18:20:02Z</updated>

                                      <category term="Z_TRAVELAGENCY_SRV.Stravelag" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

                                      <link href="TravelAgencySet('10000001')" rel="edit" title="Stravelag"/>

                                      <content type="application/xml">

                                          <m:properties>

                                              <d:Currency>USD</d:Currency>

                                              <d:Langu>E</d:Langu>

                                              <d:Url>http://www.makemytrip.com</d:Url>

                                              <d:Telephone>123-456-6789</d:Telephone>

                                              <d:Region>MA</d:Region>

                                              <d:Country>US</d:Country>

                                              <d:Agencynum>10000001</d:Agencynum>

                                              <d:Name>MakeMy Trip</d:Name>

                                              <d:City>Boston</d:City>

                                              <d:Street>50 Water St</d:Street>

                                              <d:Postbox/>

                                              <d:Postcode>02109-3902</d:Postcode>

                                          </m:properties>

                                      </content>

                                  </entry>

                              </feed>

                               

                              Any thoughts on this ? It will help me in debug further.

                               

                              **** Also the same service was working in previous releases of teiid.

                              • 14. Re: java.lang.IllegalArgumentException: type cannot be null in translator-odata
                                Ramesh Reddy Master

                                Let's please keep the topic focused on one topic. You need to show me the error on the SAP service you provided for me to recreate to provide any suggestions. My previous comment was based on the your query you submitted.

                                1 2 Previous Next