Select to view content in your preferred language

JsonParseException: Unexpected character ('<' (code 60))

14601
7
Jump to solution
06-05-2017 03:58 AM
spkiwijohnson
Deactivated User

Hello everyone. The problem is really strange: when loading layers (ArcGISDynamicMapServiceLayer) on the android app using arcgis, the code throws a JsonParseException (as far as I can see it happens when initializing new ArcGISDynamicMapServiceLayer(map.getMapurl());).

The rest and the url is fine, moreover, the app didn't have such issues before, everything worked well. Did someone somehow deal with this? 

06-05 07:27:21.746 24663-25710/nl.proclass.docs2go E/ArcGIS: url =http://api.proclass.nl/arcgis/rest/services/Handmatig_Toegevoegd/Handmatig_Toegevoegd/MapServer
org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.StringReader@306f27f; line: 1, column: 2]
at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1432)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)
at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198)
at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485)
at com.esri.core.internal.io.handler.h.a(SourceFile:206)
at com.esri.core.internal.io.handler.h.a(SourceFile:63)
at com.esri.core.internal.tasks.ags.t.a(SourceFile:39)
at com.esri.android.map.ags.ArcGISDynamicMapServiceLayer.initLayer(SourceFile:280)
at com.esri.android.map.ags.ArcGISDynamicMapServiceLayer$1.run(SourceFile:193)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

0 Kudos
1 Solution

Accepted Solutions
AlexanderNohe1
Honored Contributor

I was able to load :

https://api.proclass.nl/arcgis/rest/services/ATP_BuildingLayouts/ATP_BuildingLayouts/MapServer

on Android using the following snippet:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MapView mapView = (MapView) findViewById(R.id.map);
        mapView.addLayer(new ArcGISDynamicMapServiceLayer("https://api.proclass.nl/arcgis/rest/services/ATP_BuildingLayouts/ATP_BuildingLayouts/MapServer"));
    }
}

No error was propagated and the layer loaded fine.

View solution in original post

7 Replies
AlexanderNohe1
Honored Contributor

Which version of the runtime are you using?

What is the data type of this object : "map"?

Is this the URL that you are trying to view:

http://api.proclass.nl/arcgis/rest/services/Handmatig_Toegevoegd/Handmatig_Toegevoegd/MapServer ?

0 Kudos
spkiwijohnson
Deactivated User

The current version is 10.2.9.

map is the entity of MAP_LAYER, the getUrl method actually returns the following url which I mentioned (as well as the other two which also fail):

http://api.proclass.nl/arcgis/rest/services/Handmatig_Toegevoegd/Handmatig_Toegevoegd/MapServer

http://api.proclass.nl/arcgis/rest/services/Handmatig_Toegevoegd_Prive/Handmatig_Toegevoegd_Prive/Ma...

http://api.proclass.nl/arcgis/rest/services/ATP_BuildingLayouts/ATP_BuildingLayouts/MapServer

And yes, that is the url which I am trying to view. The same urls in the iOS don't seem to have any trouble, the problems only started on android about a month ago.

0 Kudos
AlexanderNohe1
Honored Contributor

I see that error as well.  I am also having trouble loading these features in ArcGIS Online Map Viewer or in the ArcGIS Javascript viewer.  Are you facing similar issues there?

0 Kudos
spkiwijohnson
Deactivated User

ArcGIS Online Map Viewer or ArcGIS Javascript viewer actually show that everything is ok.

http://api.proclass.nl/arcgis/rest/services/ATP_BuildingLayouts/ATP_BuildingLayouts/MapServer this case works out well. Not so good on Android, however.

0 Kudos
AlexanderNohe1
Honored Contributor

I was able to load :

https://api.proclass.nl/arcgis/rest/services/ATP_BuildingLayouts/ATP_BuildingLayouts/MapServer

on Android using the following snippet:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MapView mapView = (MapView) findViewById(R.id.map);
        mapView.addLayer(new ArcGISDynamicMapServiceLayer("https://api.proclass.nl/arcgis/rest/services/ATP_BuildingLayouts/ATP_BuildingLayouts/MapServer"));
    }
}

No error was propagated and the layer loaded fine.

spkiwijohnson
Deactivated User

Thanks a lot, now I see what the problem was. Apparently, I was using the "http" instead of "https". After switching everything went back to normal.

0 Kudos
AlexanderNohe1
Honored Contributor

Nice!  Glad you were able to get this resolved.

0 Kudos