Exception java.lang.StringIndexOutOfBoundsException in REST JSON Grails - json

I used the plugin "JSON RESTful API for GORM" for Grails and I have the next exception:
Error 500: Internal Server Error
java.lang.StringIndexOutOfBoundsException
Message
String index out of range: -1
Around line 64 of JSONDomainMarshaller.groovy
But this only happens when my class domain has a reference to another class domain, the other simple class domain runs perfect.
I hope you can help.

Related

Circular error-handler detected at route: {} - breaking out processing Exchange: {}

I am having multiple camel routes written in Java DSL exceptions are handled using OnException.
Below are my requirements.
Fetch token from cache and make http call
If http call fails with invalid token then make a back end call to get new token and then make http call
If http call fails with specific error then needs to handle it properly.
Issue:
If http call fails with invalid token then it is making backend call to fetch the token and then calling http request using exception handling code. Now the http call failed again while calling from OnException with some other error and it is not going to OnException and giving circular error handler message.
Please help me to handle this error. Thankyou
I am using SpringBoot camel starter 3.8.0 and Java 11

Randomly failed because of JSON::ParserError : 822: unexpected token

I have a REST POST API that receives json data and validates parameters. In the production environment, the API sometimes raises an exception:
JSON::ParserError : 822: unexpected token at ...
The stack trace is like:
> .../gems/ruby-2.2.10/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
> .../gems/ruby-2.2.10/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
> .../gems/ruby-2.2.10/gems/activesupport-4.2.10/lib/active_support/json/decoding.rb:26:in `decode'
It seems that the error occurs randomly; I cannot find any pattern.
When I try the same code with the dumped data, there is no parsing error.
I thought the error is due to running in concurrent, but I tried it in local with 1000 concurrent requests, which are far more than in the production environment, and it still works without any error.
I appreciate to throw some light.
What does the 822 mean in the error message? It does not seem to be the character position in the json data.

Failed to fetch swagger with error message: Unexpected end of JSON input

I have a Function app, which i am calling from a logic App. When ever i am adding the Action for function app, My funciton app unable to retrive. Its showing the below error
Failed to fetch swagger with error message: Unexpected end of JSON
input. Ensure you have CORS enabled on the endpoint and are calling a
valid HTTPS endpoint
I have refereed --> Stackoverflow , but its not working.
Any help is really appreciated.
.

JsonSerializer throwing org.codehaus.jackson.map.JsonMappingException: 4000 (through reference chain: during serialization

I'm getting
java.lang.ArrayIndexOutOfBoundsException: 4000
exception during JsonSerializer with a particular Object value and rest call is resulting in
500Internal Server Error.
below is the exception returned to Dispatcher Servlet after the call is returned back to the client from Rest API call.
org.codehaus.jackson.map.JsonMappingException: 4000 (through reference
chain:
I have tried upgrading the jackson jar version also from 1.9.2 to 1.9.5 and 1.9.13, but still throwing the same exception.
I have tried making all involved POJO objects as serializable also.
If I modify anything in JSON data call is successful with Response 200.
I can't use JSON ignore property also as fields all required.
The same code works fine for other transaction.
Please share some knowledge on it.

Message relay for JSON data in wso2ESB

I am trying to build a simple POC using wso2ESB. I've created a simple pass through proxy service with an Alfresco service http://www.alfresco.com/
The problem is I am not getting the full JSON data. I've read it has something to do with the axis2-JSON and that it causes problems when one has JSONArray in the root. So I've decided to use message relay.
WSO2 ESB Unable to convert complete JSON data to XML
I've edited the axis2.xml as described in the documentation thus adding the following lines
<messageFormatter contentType="application/json"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
and
<messageBuilder contentType="application/xml"
class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
But after I've restarted the server when I try to use the proxy server through the firefox REST plugin the ESB throws the following exception
[2012-07-12 10:02:29,125] WARN - ClientWorker Unexpected response received. HTTP response co
de : 405 HTTP status : Method Not Allowed exception : SOAP message MUST NOT contain a Documen
t Type Declaration(DTD)
[2012-07-12 10:02:29,125] ERROR - NativeWorkerPool Uncaught exception
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to org.
apache.axiom.om.OMElement
at org.apache.synapse.util.MessageHelper.cloneSOAPFault(MessageHelper.java:441)
at org.apache.synapse.util.MessageHelper.cloneSOAPEnvelope(MessageHelper.java:254)
at org.apache.synapse.core.axis2.SOAPUtils.convertSOAP11toSOAP12(SOAPUtils.java:95)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbac
kReceiver.java:323)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackRecei
ver.java:160)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:275)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.ja
va:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
What causes this? Is the problem that ESB still tries to convert the JSON object instead of trying to relay it?
Is there another workaround in parsing these JSON objects (i.e. adding artificial root to the JSON object?)
at the builders you need to set the application/json to use org.wso2.carbon.relay.BinaryRelayBuilder as well.