Discussion:
java.lang.NullPointerException Null Pointers are another name for undefined values.
(too old to reply)
dennis longnecker
2008-06-17 13:47:21 UTC
Permalink
My website is getting the following error message on occassion. If I click
refresh, the page displays correctly.

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.

ROOT CAUSE:
java.lang.NullPointerException
at com.mysql.jdbc.Statement.setMaxRows(Statement.java:2178)
at coldfusion.server.j2ee.sql.JRunStatement.setMaxRows(JRunStatement.java:214)
at coldfusion.sql.Executive.executeQuery(Executive.java:1276)
at coldfusion.sql.Executive.executeQuery(Executive.java:1008)
at coldfusion.sql.Executive.executeQuery(Executive.java:939)
at coldfusion.sql.SqlImpl.execute(SqlImpl.java:325)
at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:831)
at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:521)
at
cfheader2ecfm1821119872.runPage(C:\Inetpub\vhosts\gyro4.org\httpdocs\includes\he
ader.cfm:6)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661)
at
cfIndex2ecfm96819572.runPage(C:\Inetpub\vhosts\gyro4.org\httpdocs\Index.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)

My header.cfm starts with:

<cfset todaysdate = "#DateFormat(now(),"mm/dd/yyyy")#">
<cfquery name="Get_Menu" Datasource="gyro4_Content">
SELECT *
FROM DynamicContent
WHERE (StartDate <= #CreateODBCDate(todaysdate)#) AND (EndDate >=
#CreateODBCDate(todaysdate)#) AND (MenuBar = 'Y')
</cfquery>

And each of the values is defined correctly (plus, why would a refresh of the
page work).

ANy suggestions on debugging this further?
Azadi
2008-06-17 14:17:31 UTC
Permalink
1) what's in the rest of the header? does maxrows figure anywhere there?
2) you are setting todaysdate to a string, and then passing that string
to createodbcdate() function in your query. createodbcdate needs a date,
not a string. just use createodbcdate(now()) instead.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
dennis longnecker
2008-06-17 17:01:43 UTC
Permalink
I did the date suggestion...still errors occassionally. I believe I attached
the rest of the code. Is there any way to find out what code coldfusioon is
actually having problems with?

<cfinclude template="/includes/checklogin.cfm">

<cfset todaysdate = createodbcdate(now())>

<cfquery name="Get_Menu" Datasource="gyro4_Content">
SELECT *
FROM DynamicContent
WHERE (StartDate <= #CreateODBCDate(todaysdate)#) AND (EndDate >=
#CreateODBCDate(todaysdate)#) AND (MenuBar = 'Y')
</cfquery>

<cfif bLoggedIn eq True>
<cfquery name="getAuth" datasource="gyro4_Members">
SELECT *
FROM roster
WHERE email_address = '#session.email_address#'
</cfquery>
</cfif>

<html>
<head>
<title>Gyro District IV</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK href="/includes/style.css" type=text/css rel=stylesheet>
</head>
<body bgcolor="ffffff" text="000000" link="993300" vlink="993300"
alink="cc0000" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"
style="margin:0;">
<script type="text/javascript"
src="http://www.gloriadeikids.org/includes/swfobject.js"></script>

<table width="100%" border="0" cellpadding="0" cellspacing="0" height="93">
<tr bgcolor="5879ba">
<td aligh="left" width="81%">
<font face="Comic Sans MS" size="7">&nbsp;&nbsp;Gyro District
IV</font></td>
<td width="12%">

<div id="theMini">Generated By <a
href="http://www.flashyourweb.com/staticpages/index.php?page=embed-o-rator"
target="_blank">The Acme MiniSlideShow EMBED-O-RATOR</a></div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("http://www.gyro4.org/gallery2/minislideshow.swf",
"minislideshow", "140", "100", "9.0.115.0", "ffffff");

so.addParam("flashVars","xmlUrl=http://www.gyro4.org/gallery2/mediaRss.php?mode=
dynamic%26g2_view=dynamicalbum.RandomAlbum&linkTarget=_blank&fullscreenIcon=fals
e&showControls=false");
so.addParam("wmode","transparent");
so.addParam("allowFullscreen","true");
so.addParam("allowScriptAccess","always");
so.write("theMini");
// ]]>
</script>

</td>
</tr>
<!-- Next Line -->
<tr>
<td align=left bgcolor="999999"><font color="0000FF" size="2"><a href="/">
<a href="/index.cfm" class="leftnavlink"><font
size="3">&nbsp;&nbsp;&nbsp;&nbsp;<strong>Gyro District IV
Home</strong></a></font>
</td>
<cfif bLoggedIn eq True>
<cfoutput>
<td nowrap align=right bgcolor="999999"><a
href="/logout.cfm">Logout:#session.name# (#session.club#)</a></td>
</cfoutput>
<cfelse>
<td align=right bgcolor="999999"><a href="/login.cfm">Member Login</a></td>
</cfif>
</tr>
</table>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr align="left" valign="top">
<td align="left" valign="top" nowrap bgcolor="003366" width="140"
class="leftnavlink">
<table cellspacing="0" cellpadding="0" border="0">
<br>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/index.cfm" class="leftnavlink">Gyro IV Home</a></td>
</tr>
<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<!----------------About Gyro------>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/DisplayDetailDescription.cfm?CLASS=About Gyro"
class="leftnavlink">About Gyro</a></td>
</tr>
<!----------calendar---->
<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/calendar.cfm" class="leftnavlink">Calendar</a></td>
</tr>
<!---------clubs-------->

<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/clubs.cfm" class="leftnavlink">Clubs</a></td>
</tr>
<!-------------Executives Other Links Governor's Bulletins----->
<!-- Now get the dynamic Entries -->
<cfoutput>
<cfloop query="Get_Menu">
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/DisplayDetailDescription.cfm?CLASS=#title#"
class="leftnavlink">#title#</a></td>
</tr>
<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
</cfloop>
</cfoutput>
<!--------photo gallery-------->
<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/gallery2/" class="leftnavlink">Photo Gallery</a></td>
</tr>

<!-----------guest book-------------->
<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/GuestBook.cfm" class="leftnavlink">Guest Book</a></td>
</tr>
<!-------------------------------------------------- Members Only
----------------------------------------->
<cfif bLoggedIn eq True>
<tr><td colspan=2>&nbsp;</td></tr>
<tr><td colspan=2><b><font color="#FFFFFF">&nbsp;Members
Only:</font></b></tr></td>
<!----Update profile----->

<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/UpdateInfo.cfm" class="leftnavlink">Update Profile</a></td>
</tr>


<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<!---------Club members------->
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/DisplayMemberInformation.cfm" class="leftnavlink">Club
Members</a></td>
</tr>
<!-----------email clubs------->
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/send_email_members.cfm" class="leftnavlink">E-mail
Clubs</a></td>
</tr>
<!-----------email officers------>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/send_email_executives.cfm" class="leftnavlink">E-mail
Officers</a></td>
</tr>
<!------------reports---------->
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/reports/index.cfm" class="leftnavlink">Run Reports</a></td>
</tr>
<!-------change password-------->
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/inside_changepassword.cfm" class="leftnavlink">Change
Password</a></td>
</tr>

<!------------------Club Bulletins------------------->
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/Bulletins.cfm" class="leftnavlink">Club Bulletins</a></td>
</tr>
<!-------------------News Around the District--------->
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/news.cfm" class="leftnavlink">News Around the
District</a></td>
</tr>
<!-------------------Help Using this Site--------->
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/Displayhelp.cfm" class="leftnavlink">Help Using This
Site</a></td>
</tr>
<!--------Master Admin--------->
<cfif getAuth.Admin_Role eq "MASTER">
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/admin/index.cfm" class="leftnavlink">Admin Page</a></td>
</tr>
</cfif>
<!-------------Club Admin----->
<cfif session.role eq "Club">
<br>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/admin/index.cfm" class="leftnavlink">Admin Page</a></td>
</tr>
</cfif>

</cfif>
<!--------------CONTACT------->
<tr><td colspan=2>&nbsp;</td></tr>
<tr><td colspan=2 align="left" valign="top"><img
src="/images/header_line.gif" width="159" height="1"></td></tr>
<tr>
<td width="8"><img src="/images/header_arrow.gif" width="8"
height="7"></td>
<td><a href="/contact.cfm" class="leftnavlink">Contact Us</a></td>
</tr>
</table>
</td>

<td bgcolor="ffffff">
GArlington
2008-06-18 08:53:05 UTC
Permalink
Post by dennis longnecker
I did the date suggestion...still errors occassionally. I believe I attached
the rest of the code. Is there any way to find out what code coldfusioon is
actually having problems with?
Usually whne you enable debugging and use <cftry>...<cfcatch><cfdump
var="#cfcatch#" /></cfcatch></cftry> CF will show you more then enough
info to find your problem...
Post by dennis longnecker
<cfinclude template="/includes/checklogin.cfm">
Sometimes CF does NOT count line numbers correctly with <cfinclude .../
Post by dennis longnecker
and I suspect that your error is there as I explained in my previous
post [using persistent scope vars BEFORE setting them], try to copy
and paste the code from inlided page into your main page...
Post by dennis longnecker
<cfset todaysdate = createodbcdate(now())>
<cfquery name="Get_Menu" Datasource="gyro4_Content">
SELECT *
FROM DynamicContent
WHERE (StartDate <= #CreateODBCDate(todaysdate)#) AND (EndDate >=
#CreateODBCDate(todaysdate)#) AND (MenuBar = 'Y')
</cfquery>
<cfif bLoggedIn eq True>
<cfquery name="getAuth" datasource="gyro4_Members">
SELECT *
FROM roster
WHERE email_address = '#session.email_address#'
</cfquery>
</cfif>
If you get CF error then javascript and HTML (and any other client
side code is irrelevant)...
<snap>
Post by dennis longnecker
<td nowrap align=right bgcolor="999999"><a href="/logout.cfm">Logout:#session.name# (#session.club#)</a></td>
<snap>

Always remember - CF is (most of the time) checking if your page was
changed recently before running it, if it finds that the page WAS
changed CF will re-comile the page on-the-fly. This gives you unique
opportunity to change your code as often as you like. This gives you a
great way of finding bugs in your code - the way is called <cfdump .../
Post by dennis longnecker
. Insert this statement around the suspected error and see how the
processing is going...

GArlington
2008-06-17 15:45:53 UTC
Permalink
Post by dennis longnecker
My website is getting the following error message on occassion. If I click
refresh, the page displays correctly.
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.
java.lang.NullPointerException
at com.mysql.jdbc.Statement.setMaxRows(Statement.java:2178)
at coldfusion.server.j2ee.sql.JRunStatement.setMaxRows(JRunStatement.java:214)
at coldfusion.sql.Executive.executeQuery(Executive.java:1276)
at coldfusion.sql.Executive.executeQuery(Executive.java:1008)
at coldfusion.sql.Executive.executeQuery(Executive.java:939)
at coldfusion.sql.SqlImpl.execute(SqlImpl.java:325)
at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:831)
at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:521)
at
cfheader2ecfm1821119872.runPage(C:\Inetpub\vhosts\gyro4.org\httpdocs\includes\he
ader.cfm:6)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661)
at
cfIndex2ecfm96819572.runPage(C:\Inetpub\vhosts\gyro4.org\httpdocs\Index.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
<cfset todaysdate = "#DateFormat(now(),"mm/dd/yyyy")#">
<cfquery name="Get_Menu" Datasource="gyro4_Content">
SELECT *
FROM DynamicContent
WHERE (StartDate <= #CreateODBCDate(todaysdate)#) AND (EndDate >=
#CreateODBCDate(todaysdate)#) AND (MenuBar = 'Y')
</cfquery>
And each of the values is defined correctly (plus, why would a refresh of the
page work).
ANy suggestions on debugging this further?
Usually this kind of behaviour is exhibited when you set vars in
persistent scope(s) like session or application. If you are using
Application.cfc you have to know exactly what happens in what sequence
- see CF docs Application.cfc (http://livedocs.adobe.com/coldfusion/7/
htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?
context=ColdFusion_Documentation&file=00000692.htm)
Loading...