While hitting JAVA rest API from Oracle cloud Integration(OIC) the job fails with the 500 internal sever error after running for sometime. I doubt it being issue with the JAVA API and I don't see any error on the API Prod logs.
Another point to note is, that OIC is hitting this API multiple times(in a loop) but it doesn't fail immediately. It is successful one to two loops and then fails.
Can it be related to JVM heap size?
Error Details:
com.oracle.bpel.client.BPELFault: faultName: {{http://xmlns.oracle.com/cloud/adapter/REST/UpdateAPInvoicesStatus_REQUEST}APIInvocationError}
parts: {{
null=<soap-env:Fault xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><faultcode xmlns:faultsrc="http://xmlns.oracle.com/cloud/adapter/REST/UpdateAPInvoicesStatus_REQUEST">faultsrc:APIInvocationError</faultcode><faultstring>ICS runtime execution error</faultstring><detail><ICSfaultVar>
<ns2:APIInvocationError xmlns:ns2="http://xmlns.oracle.com/cloud/generic/rest/fault/REST/UpdateAPInvoicesStatus"><ns2:type/><ns2:title/><ns2:detail/><ns2:errorCode/><ns2:errorDetails><ns2:type>http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1</ns2:type><ns2:title>Internal Server Error</ns2:title><ns2:errorCode>500</ns2:errorCode><ns2:errorPath><![CDATA[https://api.containersforchange.com.au/api/v1/ap-invoice/status]]></ns2:errorPath><ns2:instance><![CDATA[CASDK-0041: An error occurred while invoking the REST endpoint.[[java.net.SocketTimeoutException: Read timed out]].The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the server side, but the target service could not be more specific on what the exact problem is. You can trace the cURL representation of the request sent to the target service from the Oracle Integration Cloud server logs. Try invoking the target service using cURL. If the problem persists, co <ns2:APIInvocationError xmlns:ns2="http://xmlns.oracle.com/cloud/generic/rest/fault/REST/UpdateAPInvoicesStatus"><ns2:type/><ns2:title/><ns2:detail/><ns2:errorCode/><ns2:errorDetails><ns2:type>http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1</ns2:type><ns2:title>Internal Server Error</ns2:title><ns2:errorCode>500</ns2:errorCode><ns2:errorPath>&lt;![CDATA[https://api.containersforchange.com.au/api/v1/ap-invoice/status]]&gt;</ns2:errorPath><ns2:instance>&lt;![CDATA[CASDK-0041: An error occurred while invoking the REST endpoint.[[java.net.SocketTimeoutException: Read timed out]].The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the server side, but the target service could not be more specific on what the exact problem is. You can trace the cURL representation of the request sent to the target service from the Oracle Integration Cloud server logs. Try invoking t :Application Error</reason><operation>execute</operation></detail></soap-env:Fault>}
cause: {null}
Rest API
@GET
@Path("batch/{batchId}")
@ActionType("VIEW")
public TransactionWrapper findAll(@PathParam("batchId") String batchId,
@QueryParam("pageNumber") Integer pageNumber, @QueryParam("pageSize") Integer
pageSize) {
return IGenerationServiceAsync.findAll(batchId, pageNumber, pageSize);
}
Service
@Override
public TransactionWrapper findAll(String iBatchId, Integer pageNumber,
Integer pageSize) {
final List<ITransaction> generatedInvoices = new ArrayList<>();
QTransactionRecHeader iHeader =
QTransactionRecHeader.transactionRecHeader;
JPQLQuery<TransactionRecHeader> query = getQueryFactory().from(iHeader)
.select(iHeader)
.where(iHeader.invoiceBatchId.eq(iBatchId))
.orderBy(iHeader.invoiceNumber.asc());
Long iCount = query.fetchCount();
if (iCount == 0) {
return new TransactionWrapper(generatedInvoices);
}
pageSize = pageSize == null ? iCount.intValue() : pageSize;
pageNumber = pageNumber == null ? 0 : pageNumber;
query.limit(pageSize);
query.offset(pageNumber * pageSize);
Pageable pageRequest = new QPageRequest(pageNumber, pageSize);
Page<TransactionRecHeader> iHeaders = new PageImpl<>(query.fetch(),
pageRequest, iCount);
Iterator<TransactionRecHeader> iterator = iHeaders.iterator();
while (iterator.hasNext()) {
final ITransaction response = new TransactionHeader(iterator.next());
generatedInvoices.add(response);
}
return new TransactionWrapper(generatedInvoices);
}
The API is being called from the OIC in a loop for 200 records at a time. The API returns 200 records which means pageSize is 200. After fetching 200 records, pageNumber is incremented for next 200 records.
Itried a lot of things, but I am clueless on the why is there this read timeout after 2-3 loops.