Expected BEGIN_OBJECT but was STRING at line 1 column 1

13,230 views
Skip to first unread message

Bishan Buddhika

unread,
Aug 7, 2014, 1:27:31 AM8/7/14
to google-a...@googlegroups.com

I'm getting below error from my google app engine program. But when i run this program on my PC, it's working without any errors. Below error is getting when uploaded to google app engine and run from there.

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1

Here is the link for my question with code snippets.


 

Vinny P

unread,
Aug 7, 2014, 11:26:35 PM8/7/14
to google-a...@googlegroups.com

On Thu, Aug 7, 2014 at 12:27 AM, Bishan Buddhika <tvbi...@gmail.com> wrote:

I'm getting below error from my google app engine program. But when i run this program on my PC, it's working without any errors. Below error is getting when uploaded to google app engine and run from there.

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1


Hi Bishan,

A few things:

1. Please post the entire stack trace including line numbers, not just the exception message.

2. Your code is directly opening up a stream to the data URL, without checking to see if the input is valid. Can you modify your code to show the status code being returned by the feed server (it should be 200) and print out into logging the text received from the server? Here's example code to show the status code returned: http://stackoverflow.com/a/6467904

3. When you say "when i run this program on my PC, it's working without any errors" are you running the code within the development app server or another server? Are you pulling the data feed from the feed server or using test JSON text? If you are pulling the data from the feed server, is the JSON you posted a representative sample of the JSON you expect to receive? If not, please describe the JSON you do expect to receive (sample JSON is OK too).

 
-----------------
-Vinny P
Technology & Media Consultant
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Bishan Buddhika

unread,
Aug 8, 2014, 1:00:09 AM8/8/14
to google-a...@googlegroups.com
Hi,

Thank you very much for your reply. Your reply guided me to find the error. I got 403 as Response Code and now i found the error. :)

Vinny P

unread,
Aug 8, 2014, 11:57:36 AM8/8/14
to google-a...@googlegroups.com
On Fri, Aug 8, 2014 at 12:00 AM, Bishan Buddhika <tvbi...@gmail.com> wrote:
Thank you very much for your reply. Your reply guided me to find the error. I got 403 as Response Code and now i found the error
 
 
 
Glad to hear it's working now. I thought that might be the issue :-)

Siva Sudarsan

unread,
Dec 16, 2014, 11:04:32 AM12/16/14
to google-a...@googlegroups.com
Hi,
I want to call cloudformation template(.json) and send  values to it dynamically thru java(bean)...parameters
If anyone has idea please let meknow

Vinny P

unread,
Dec 22, 2014, 3:44:51 AM12/22/14
to google-a...@googlegroups.com
On Tue, Dec 16, 2014 at 10:04 AM, Siva Sudarsan <vsivas...@gmail.com> wrote:
I want to call cloudformation template(.json) and send  values to it dynamically thru java(bean)...parameters



You're posting on the wrong forum. CloudFormation is an AWS product not related to Google.

Reply all
Reply to author
Forward
0 new messages