Reply to topic
Null Pointers
Seamus


Joined: 11 Apr 2008
Posts: 8
Reply with quote
Hello All,
I'm still new to ColdFusion, so bare with me while I try to describe my problem.

I keep getting this error, seemingly at random:
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.

Null Pointers are another name for undefined values.

The error occurred in C:\Websites\156140uf8\cfc\Blog.cfc: line 4

2 :
3 : <cffunction name="getAllEntries" access="public" returntype="query">
4 : <cfquery name="qBlog" datasource="#application.datasource#" password="#application.password#" username="#application.username#" >
5 : SELECT *
6 : FROM blog


I set all those variables in the Application.cfc using this code...

<cffunction name="onRequestStart" access="public" returntype="void">
<cfif NOT isDefined("application.datasource")>
<cfset application.datasource="mydsn" >
<cfset application.password= "mypassword">
<cfset application.username= "myusername">
</cfif>
</cffunction>



When I dump the application object, all those variables show up correctly, so I can't begin to think why it's causing an exception. Anyone have any ideas?
emmet


Joined: 16 Nov 2004
Posts: 27
Reply with quote
Did you set all the settings correctly in settings.ini?
Seamus


Joined: 11 Apr 2008
Posts: 8
Reply with quote
Sorry, like I said I'm new to this.

I don't know if setting.ini is there or if I have to create it.
I had originally written the datasource name, username, and password directly in Application.cfc (Where you see mypassword etc). After reading your post and doing a little research, I realized that I didn't need to add the username and password. (like I said I'm new to this Embarassed )
I haven't been able to do any extensive testing, but I haven't seen the error since making that change.
Do you think that could have been the source of my error?
emmet


Joined: 16 Nov 2004
Posts: 27
Reply with quote
Definitely the source of your issue. Blogcfc only needs the ini edit and your fine. Just remember to ?reinit after making any code changes and you'll be fine.
Seamus


Joined: 11 Apr 2008
Posts: 8
Reply with quote
So, it looks like the problem persists.

I apologize once again, but I don't really understand what you mean by "reinit"-ing. I though that by setting the datasource on "onRequestStart", it would check to see if it's defined every server request, but it sounds like it's not as simple as that.
emmet


Joined: 16 Nov 2004
Posts: 27
Reply with quote
By reinit i mean add ?reinit=1 at the end of your url to dump the application scope. If your blog url is www.foo.com/blog then go to www.foo.com/blog/?reinit=1.

This is just for this application, its not a built in function in cf. BlogCFC just happens to cache the cfc in the application scope and uses ?reinit as a way to dump the application and reload.
Seamus


Joined: 11 Apr 2008
Posts: 8
Reply with quote
I'm still a bit confused.
Are you under the impression that I'm using Raymond Camden's BlogCFC? Is this something that applies to that specifically?
Seamus


Joined: 11 Apr 2008
Posts: 8
Reply with quote
Ok, so I hit upon something that gives me a better clue what I'm dealing with while working in Flex. I'm connecting to a completely different cfc, which has no Application file and explicitly spells out the dsn, and I'm still getting the error. So the problem doesn't appear to have anything to do with my Application file. Perhaps it's a problem with the sandbox settings or the way the dsn was declared.
Seamus


Joined: 11 Apr 2008
Posts: 8
Reply with quote
So for anyone who runs into this problem, it appears to be caused by the setting "Maintain connections across client requests." under the datasource advanced settings.
I don't know the specifics of why it causes the problem, but having it unchecked has cleared it all up for me.
nathacof


Joined: 24 Oct 2006
Posts: 93
Location: Bear, DE
Reply with quote
So for anyone who runs into this problem, it appears to be caused by the setting "Maintain connections across client requests." under the datasource advanced settings.
I don't know the specifics of why it causes the problem, but having it unchecked has cleared it all up for me.


We've seen this for a number of our customers going from CF7 -> 8.

Unfortunately I'm not any more sure of why it's occurring than you.

Sorry I hadn't read the thread earlier. Sad
dreamplanner


Joined: 28 May 2008
Posts: 1
Location: Michigan
Reply with quote
I get the same Null Pointers error. It seems to happen the first time I visit any page that has a database call. If I refresh the browser, the page loads fine.

So, where do I find the "datasource advanced settings"? Is there something else that might be causing the problem?
tedjtw


Joined: 08 Feb 2005
Posts: 80
Location: Connecticut
Reply with quote
If you are using MySQL with CF8 there is an issue with the DSN maintain connections settings.

The setting is enabled by default. Which is correct since then a new connection to the database is not needed for every page view. However there is a little known problem.

Most of the time the DSN info is in Application.cfm or .cfc. The .cfm is read each time a page is viewed. So the chances of the 'bug' biting on any given page are pretty good. Not always, but fairly often. Drove us nuts.

Have HMS support uncheck the maintain connections option for your DSN in CF Admin.

That should stop it. Of course if you are not using MySQL then ....................?

BTW, this does not happen on our in-house servers at all, just shared so far. I kinda guess the other wildcard here is the sandbox. We don't use it in house.

HTH
Null Pointers
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic