cancel
Showing results for 
Search instead for 
Did you mean: 

An exception of type 'IllegalStateException' occurred.

0 Kudos

Hello Colleagues,

In my fullstack web ide , i was developing a business application. i couldn't do a post in the odata and i was receiving this error.

EntityProviderException: An exception of type 'IllegalStateException' occurred.","\t... 46 more","Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $","\tat com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)","\tat org.apache.olingo.odata2.core.ep.consumer.JsonEntryConsumer.readSingleEntry(JsonEntryConsumer.java:85)","\t... 45 more"] }

My Service.cds code is using my.bookshop from '../db/data-model';
service CatalogService {
  entity SupplierProduct @insert  @read @update @delete  as projection on bookshop.MarketContext.MarketLocation.MarketSPace;
  entity Market   @insert  @read @update @delete  as projection on bookshop.MarketContext.Product.ProductMaster;
  entity Sales   @insert  @read @update @delete  as projection on bookshop.MarketContext.Sales.Sales;
}



[
  {
    "COMPANY_ID": "C2002189",
    "COUNTRY": "UNITED STATES",
    "CITY": "CALIFORNIA",
    "STATE_COUNTY": "NEVADA",
    "PINCODE": 89108,
    "MARKETVALUE": 500000,
    "GENERATING_INCOME": 36000,
    "MARKET_OWNER": "Ashlin Gabriel",
    "START_YEAR": "2011-02-03",
    "CURRENCY": "USD"
  }
]

Json data that i tried to push.

and is there any other way of loading data in to the table in business application from a csv as currently the data uploader of fullstack ide is not working.

Kindly Help.!

Br,

Gabriel.

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos
<?xml version='1.0' encoding='UTF-8'?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code/>
    <message xml:lang="en-US">Illegal argument for method call with message 'COMPANY_ID'.</message>
</error>

This is what i get now.! 😞

Please help me here also is there anyways we can do a post of multiple records with this . i know currently we can handle this requirement with XSODATA and XSJS but i am not sure if this is possible with the Nodejs version of cds service.

@SAP Experts please enlight us!

nabheetscn
Active Contributor
0 Kudos

From the exception it looks it is expecting an object and you are passing array. Can you try with this data

  {
    "COMPANY_ID": "C2002189",
    "COUNTRY": "UNITED STATES",
    "CITY": "CALIFORNIA",
    "STATE_COUNTY": "NEVADA",
    "PINCODE": 89108,
    "MARKETVALUE": 500000,
    "GENERATING_INCOME": 36000,
    "MARKET_OWNER": "Ashlin Gabriel",
    "START_YEAR": "2011-02-03",
    "CURRENCY": "USD"
  }