Unhandled NilObjectException

Hi,
I am starting developing with xojo, and my 1st webapp works justfine when I debugg it in my local machine. Then after uploading it and when i try to access a mysql database, occurs an error:
This application has encountered an error and cannot continue.
[i]Unhandled NilObjectException
Message:

Stack:
WebPage1.WebPage1.ListarRegistos_Action%%o<WebPage1.WebPage1>o
Delegate.IM_Invoke%%o
AddHandler.Stub.28%%
WebButton._ExecuteEvent%b%osA1v
WebControl.!_ExecuteEvent%b%ssA1v
WebSession._HandleEvent%%oso<HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i4%oso<HTTPServer.HTTPRequestContext>
WebApplication.HandleHTTPRequest%%oo<HTTPServer.HTTPRequestContext>
_CGIGateway.GatewayRequestThread.Event_Run%%o<_CGIGateway.GatewayRequestThread>[/i]

I made a step by step test when I found that it was in this command code:

data = databasename.SQLSelect(sql)

maybe variable “databasename” is nil?

Hi
Thanks for the reply.
Localy on http://127.0.0.1/ works fine
The database is accessed from my local machine to a remote server as in the remote server.

maybe check your code?
Somewhere you open connection and that could fail.

So
why does it work localy?

USe the remote connection within the debugger and then stop the debugger at data = databasename.SQLSelect(sql) and check data, databasename and sql for NIL.

And you should add a If (databasename<>Nil, GoOnWithThat, StopDoingThis) somewhere. :slight_smile:

I would double check the mysql server on the remote machine is setup as you expect particularly with respect to the users. I just did what you a couple of weeks ago, and although I had everything setup correct on my home machine, when I moved it to a Linux VPS all did not play nice.

I knew it was how I setup MySQL. Took some messing around but was down to the user account I had setup & permissions.

As already mentioned make sure you perform checks for nil objects on the database as well.

Thanks everyone for the help.

The problem was:
Outside de the server has I granted % acess to the user there was no problem the web app works fine.
Inside the same server, the acess was blocked why?

  • The server name is not ‘localhost’

Solution:
grant full acess to the interal server name in the acesses host