Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

SMP Java exception at OData JDBC custom script

$
0
0

Hi,

 

I have developed a test SAPUI5 application:

- MySQL is the backend that contains one table "employee" with some data

- SMP (SP10 PL9) Integration Gateway is used as the OData source between mysql and frontend

- JDBC is the protocol

- Eclipse Luna is the IDE installed with latest plugins (SAP Development Tools downloaded from "https://tools.hana.ondemand.com/luna")

- OData model is defined with one entity "employee" with JDBC as data source

 

Everything works fine except the case when OData Model has custom JS script.  The following is snippet of the code - the other 3 functions are the original with empty logic:

function processRequestSQL(message)

{

  importPackage(com.sap.gateway.ip.core.customdev.util);

  importPackage(java.util);

  importPackage(org.apache.olingo.odata2.api.edm);

  importPackage(com.sap.gateway.core.ip.component.commons);

  importPackage(org.apache.olingo.odata2.api.uri);

  importPackage(com.sap.gateway.ip.core.customdev.logging);

 

  log.logErrors(LogMessage.TechnicalError, "Before set max records");

  message.setHeader("MaxRecords", parseInt("999999"));

  log.logErrors(LogMessage.TechnicalError, "After set max records");

  return message;

}

 

I am trying to set the "Max Records" fetched by following the instruction from: Pagination in Kapsel plugin

 

When I tested the OData query in Chrome, it error out with the following message:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<code>INTERNAL_SERVER_ERROR</code>

<message xml:lang="en">

Could not perform the operation, contact your System Administrator: Transaction ID :0ddaadb8-b5df-4f0c-8541-3233c999d0ec

</message>

</error>

 

This is the log from SMP server:

#2.0#2016-06-04 06:39:01 PM#ERROR#RequestResponse###Integration Gateway#1465083539521007#6ff00ebd-4c33-43ff-959f-a984231bfba8##com.sap.gateway.core.odata4sap.ODataErrorCallbackImpl:logError#smpAdmin#######595#####handleError(): failed to serve request for URI https://surfacepro3-jw.local:8083/gateway/odata/SAP/MYSQLEMPLOYEE;v=2/employees, message = Mapping error: Transaction ID :0ddaadb8-b5df-4f0c-8541-3233c999d0ec#

#2.0#2016-06-04 06:39:01 PM#ERROR#RequestResponse###Integration Gateway#1465083539521006#6ff00ebd-4c33-43ff-959f-a984231bfba8##com.sap.it.commons.logging.slf4j.internal.LoggerSlf4j:log#smpAdmin#######595#####[Gateway][BUSINESS][ReadEntitySetFailed]:Data Provider - readEntitySet failed: service = MYSQLEMPLOYEE , entity set = employees , message = com.sap.gateway.core.api.exception.IGWException: Mapping error : Transaction ID: 0ddaadb8-b5df-4f0c-8541-3233c999d0ec#

#2.0#2016-06-04 06:39:01 PM#ERROR#RequestResponse###Integration Gateway#1465083539521005#6ff00ebd-4c33-43ff-959f-a984231bfba8##com.sap.gateway.core.ip.provider.data.CamelDataProvider:processCamelRoute#smpAdmin#######595#####

Stacktrace

---------------------------------------------------------------------------------------------------------------------------------------

java.lang.ClassCastException: Cannot cast class java.lang.Double to class java.lang.Integer#

#2.0#2016-06-04 06:38:59 PM#ERROR#RequestResponse###Integration Gateway#1465083539521002#6ff00ebd-4c33-43ff-959f-a984231bfba8##com.sap.it.commons.logging.slf4j.internal.LoggerSlf4j:log#smpAdmin#######595#####[Gateway][TECHNICAL][TechnicalError]:After set max records#

#2.0#2016-06-04 06:38:59 PM#ERROR#RequestResponse###Integration Gateway#1465083539521001#6ff00ebd-4c33-43ff-959f-a984231bfba8##com.sap.it.commons.logging.slf4j.internal.LoggerSlf4j:log#smpAdmin#######595#####[Gateway][TECHNICAL][TechnicalError]:Before set max records#

 

It seems like the SMP engine tried to cast input parameter from Double to Integer.  I also tried the following but still failed:

- message.setHeader("MaxRecords", "999999");

- message.setHeader("MaxRecords", 999999);

The first item threw a diff error: java.lang.ClassCastException: Cannot cast class java.lang.String to class java.lang.Integer#


Am I doing something wrong? Any help is appreciated.


Thanks and Regards,

Jinlin


Viewing all articles
Browse latest Browse all 8372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>