Select to view content in your preferred language

FindTask returns "Object reference not set to an instance of an object"

1200
12
Jump to solution
09-05-2012 06:39 AM
JeremyCoulson
Occasional Contributor
Hello.  We have a project for which this example seems to be an excellent starting place: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/find_map.html

So far, we have made revisions in an attempt to include our data.  This is at http://www.co.frederick.va.us/dev/maps/test4.html.  Instead of the stuff in the example, we are trying to search for a field in our data called RECNUM.  Our data are in this service: http://gis.co.frederick.va.us/ArcGIS/rest/services/Values_PF/MapServer/1

We currently are getting this error when trying to execute a search:

dojo.io.script.jsonp_dojoIoScript2._jsonpCallback({"error":{"code":500,"message":"Object reference not set to an instance of an object.","details":[]}});


I'm totally unsure of what is happening.  When I change the findParams.layerIds from 1 to 0, I just get empty data instead of an error result. 

dojo.io.script.jsonp_dojoIoScript2._jsonpCallback({"results":[]});


findParams.layerIds = [1]; // 0 returns empty result.  1 returns Object reference not set to an instance of an object. findParams.searchFields = ["RECNUM"];


I'm kind of lost on how to proceed, so I'll be deeply grateful for any assistance.  Thanks!

Jeremy
0 Kudos
1 Solution

Accepted Solutions
JeremyCoulson
Occasional Contributor
Okay, I'm finally back here.  I spent some time on the phone with a couple of ESRI brains and this is what we came up with: Our ArcGis Desktop which created the MXD and published the service was a different version than our ArcGis Server -- 9.3 on Desktop and 9.3 sp 1 on Server.  So, we updated Desktop to the same version, republished the map service, and now it searches.  Whew!

Thanks for your help.  As I'm new to the ESRI world, I think that is one I would not have found on my own.

Jeremy

View solution in original post

0 Kudos
12 Replies
__Rich_
Deactivated User
0 Kudos
JeremyCoulson
Occasional Contributor
That does work, but the page at http://www.co.frederick.va.us/dev/maps/test4.html is the problem.  I don't think we want to just give people a link to http://gis.co.frederick.va.us/ArcGIS/rest/services/Values_PF/MapServer/find?searchText=12345&contain....
0 Kudos
__Rich_
Deactivated User
That does work, but the page at http://www.co.frederick.va.us/dev/maps/test4.html is the problem.


Indeed...and the difference between the params submitted is....?

I don't think we want to just give people a link to http://gis.co.frederick.va.us/ArcGIS/rest/services/Values_PF/MapServer/find?searchText=12345&contain....

Of course not.

I was just pointing out that the service seems to respond correctly to basic input.
0 Kudos
JeremyCoulson
Occasional Contributor
Oh.  Indeed.  Other people who used to work here wrote applications for that service.  Unfortunately, that guy is no longer around.
0 Kudos
__Rich_
Deactivated User
Try this:

http://gis.co.frederick.va.us/ArcGIS/rest/services/Values_PF/MapServer/find?searchText=12345&contain...

Then try this:

http://gis.co.frederick.va.us/ArcGIS/rest/services/Values_PF/MapServer/find?f=json&searchText=12345&...

The only difference between them is the second one specifies the response format type i.e. f=json.  (which is of course what the FindTask JS class will use)

Is there anything useful in the server logs?

Reminds me of this:

http://forums.arcgis.com/threads/63974-legend-f-json-HTTP-500?p=221983#post221983

I think we had an issue with paths to the data, perhaps it's something similar, I can't remember exactly - if I do I'll let you know.
0 Kudos
JeremyCoulson
Occasional Contributor
Unfortunately, I do not have access to those logs.

I guess we'll need to switch to QueryTask if our server won't work with JSON, but there are no examples of searching with QueryTask -- only clicking a map that already exists.

Jeremy
0 Kudos
JeremyCoulson
Occasional Contributor
Is there anything I could have GIS folks check on the server?  Perhaps a setting that would allow this FindTask to do its thing properly?

Jeremy
0 Kudos
__Rich_
Deactivated User
Is there anything I could have GIS folks check on the server?  Perhaps a setting that would allow this FindTask to do its thing properly?

Jeremy

I'd ask them to check the logs, they might need to change the logging level (depending on the current setting) to get the error logged, I think it's probably worth them putting in a support call if they have access to support?

Also send them the link that causes the error so that they can reproduce it themselves.

Here's a link to information about AGS configuration files, pay particular attention to the ErrorReport* settings:

http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#/Server_config...

Might also be worth posting to one of the AGS forums e.g. REST.

To answer your other question, here's the Query form to help you work out what parameters to send:

http://gis.co.frederick.va.us/ArcGIS/rest/services/Values_PF/MapServer/1/query

You can view the actual URI generated using Firebug or Fiddler etc.

Here's the REST documentation for Query:

http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/query.html

Here's a JSAPI sample for Query:

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/query_nomap.ht...

HTH
0 Kudos
JeremyCoulson
Occasional Contributor
Awesome.  I will check all of this out.  I'm technically off work until Monday, so I may not get to it until then.  If you don't hear from me for a few days, it isn't because I've lost interest in your assistance.  Thanks!

Jeremy
0 Kudos