Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Null Pointers are another name for undefined values

Guest
Jun 26, 2007 Jun 26, 2007
Hi all,
I am using MX 7 and PostGRESql locally on the same dev machine.
When i connect to the database with in the website for the very first time, i get the following error msg.....

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:\Inetpub\wwwroot\mysite\queries\qry_menu_contained_HTabs.cfm: line 1

1 : <cfquery name="HTabsd" datasource="#application.datasource#" dbname="#application.dbname#" username="#application.dbusername#" password="#application.dbpassword#">
2 : SELECT EXTRACT(DOW FROM TIMESTAMP 'now()') as day0fWeek
3 : </cfquery>

It does not matter which page i hit first (above is just one example), just the very first call to the database always fails. After that when i refresh the same page all is fine. Its like whole site is back alive. But very first call of any new session always fails.

Any help will be much appriciated.

Thanx

Ejaz
TOPICS
Database access
4.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 27, 2007 Jun 27, 2007
I know there are lot of people out there losing their sleep on this (I wish). But just to give you guys (& girls) an update, I noticed that although error is being reported on <CFQUERY ---- > line but in the debug information I can see that query did run. Bit confusing, cause if query tag had an error how did CF managed to run the query which produced 1 record???

Please see below the error discription ....

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:\Inetpub\wwwroot\mysite\queries\qry_menu_contained_HTabs.cfm: line 8

6 : </cfoutput>
7 : --->
8 : <cfquery name="HTabsd" datasource="#application.datasource#" dbname="#application.dbname#" username="#application.dbusername#" password="#application.dbpassword#">
9 : SELECT EXTRACT(DOW FROM TIMESTAMP 'now()') as day0fWeek
10 : </cfquery>

Resources:

* Check the ColdFusion documentation to verify that you are using the correct syntax.
* Search the Knowledge Base to find a solution to your problem.

Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Remote Address 127.0.0.1
Referrer http://127.0.0.1/mysite/menuContainerPage.cfm
Date/Time 27-Jun-07 05:47 PM
Stack Trace
at cfqry_menu_contained_HTabs2ecfm1805417246.runPage(C:\Inetpub\wwwroot\mysite\queries\qry_menu_contained_HTabs.cfm:8) at cfmenu_contained2ecfm2088362365.runPage(C:\Inetpub\wwwroot\mysite\menu_contained.cfm:64)

java.lang.NullPointerException
at java.lang.String.<init>(Unknown Source)
at macromedia.jdbc.slbase.BaseConnection.setCatalog(Unknown Source)
at coldfusion.server.j2ee.sql.JRunConnection.setCatalog(JRunConnection.java:481)
at coldfusion.server.j2ee.sql.JRunConnectionHandle.setCatalog(JRunConnectionHandle.java:133)
at coldfusion.tagext.sql.QueryTag.doFinally(QueryTag.java:607)
at cfqry_menu_contained_HTabs2ecfm1805417246.runPage(C:\Inetpub\wwwroot\swindon\queries\qry_menu_contained_HTabs.cfm:8)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.runtime.CfJspPage._emptyTag(CfJspPage.java:1915)
at cfmenu_contained2ecfm2088362365.runPage(C:\Inetpub\wwwroot\swindon\menu_contained.cfm:64)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:210)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
at coldfusion.CfmServlet.service(CfmServlet.java:107)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Debugging Information
ColdFusion Server Developer 7,0,1,116466
Template /mysite/menu_contained.cfm
Time Stamp 27-Jun-07 05:47 PM
Locale English (UK)
User Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Remote IP 127.0.0.1
Host Name 127.0.0.1

Execution Time top level (0ms) C:\Inetpub\wwwroot\mysite\Application.cfm
top level (469ms) C:\Inetpub\wwwroot\mysite\menu_contained.cfm
· arrowtop level (250ms) C:\Inetpub\wwwroot\mysite\queries\qry_menu_contained_HTabs.cfm @ line 64

(2328 ms) STARTUP, PARSING, COMPILING, LOADING, & SHUTDOWN
(2797 ms) TOTAL EXECUTION TIME
red = over 250 ms execution time

Exceptions
17:47:35.035 - java.lang.NullPointerException - in C:\Inetpub\wwwroot\mysite\queries\qry_menu_contained_HTabs.cfm : line 8

SQL Queries HTabsd (Datasource=mysite_new, Time=0ms, Records=1) in C:\Inetpub\wwwroot\mysite\queries\qry_menu_contained_HTabs.cfm @ 17:47:35.035

SELECT EXTRACT(DOW FROM TIMESTAMP 'now()') as day0fWeek
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 27, 2007 Jun 27, 2007
I've never used PostGRESql so this is a total shot in the dark. These lines suggest the exception occurred when trying to set the connection catalog (ie database). Is it possible the #application.dbname# is not set the first time or is an empty string?

java.lang.NullPointerException
at java.lang.String.<init>(Unknown Source)
at macromedia.jdbc.slbase.BaseConnection.setCatalog(Unknown Source)

You might try
a) hardcoding the cfquery dbname/etc values, restart the app, and see if that has an effect
b) establishing a dsn that doesn't require passing the dbname/password/... arguments via cfquery. Assuming its possible with PostGRESql. does it have an effect?
c) check your driver version. are there are any bugs, # of connection limitations or newer driver versions available?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 27, 2007 Jun 27, 2007
cf_dev2,
Thanx very much for your reply.
All required applicationn variables are present, as I can print them just before the first query runs.
Hard coding the variables does not make any difference at all.
Taking username and password out of <CFQUERY> tag and putting it in CF admin (ODBC Connection) again does not make any change.
I am running the most upto date ODBC driver avaliable for postGRESql.

Any more ideas?????

Has anyone ever used PostGRESql with CF??? or am I the Lucky one?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 27, 2007 Jun 27, 2007
> Taking username and password out of <CFQUERY> tag and putting it in CF admin (ODBC Connection)
Not just the username/pwd but the database name too. Are you using ODBC? The error says JDBC.

Did you also check for driver bugs and connection limitations? Other than that, I really don't know. Sorry 😕
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2007 Jun 28, 2007
There are a few NullPointerException error messages on the ColdFusion MX 7 Server that I working on. I said that it is null (SESSION variable, it was set to expired only when browser), but in fact it is NOT (or is it??)...this seem that happen at random.

Have not found solution yet...still working on it. Is it possible that garbage collector freeing currently used variable?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 28, 2007 Jun 28, 2007
Hi guys,
Thanx very much for your help and comments.
I was left with two options.
1) Try migrating to MySQL
2) Try some thing else but CF
It seems that not many people are as big of a fan of postgreSQL as me, can't leave that, no way, so i decided to go with option 2 and installed BD. Now app works a treat. I would still like to use CF but there is not much help avaliable on webnet (interweb) when it comes to combination of CF and postgreSQL.
John85,
Please drop us a line if you manage to find a solution.

Regards,

Ejaz
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 29, 2007 Jun 29, 2007
I use PostgreSQL with CF, no problems.

Don't use ODBC, it's crap. Use JDBC. Why would you use a wrapper around a wrapper? Coldfusion (starting with MX, 6.0) has a Java core. Internally, it's using JDBC. When you try to use an ODBC database driver, Coldfusion is using a JDBC/ODBC bridge. Much better to just use the JDBC driver to begin with.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2007 Jun 29, 2007
Can't use JDBC driver (Oracle Thin) because of REF CURSOR. There are a bunch of stored procedures in our database that use REFCURSOR.

I am currently using two datasource. JDBC, and the ODBC Socket bridge (only for REF CURSOR). Can't change the stored procedure to not return REF CURSOR because there are too many REF CURSOR.

By the way, the NullPointerException seem to only occurred on code that used the ODBC datasource.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 29, 2007 Jun 29, 2007
Well, there is always the Enterprise version of CF so that you can use a JDBC connection without having to use the thin client. The expensive option, unfortunately.

Phil
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2007 Jun 29, 2007
We do want Enterprise version but our client is not willing to pay the price. They need at least 10 copies of ColdFusion, so currently Enterprise version is not an option, until we convince them otherwise and they have new budget to spare.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 29, 2007 Jun 29, 2007
<cfquery name="getUserByLdap" datasource="somedatasource">
SELECT some_user_oid,
last_name,
first_name
FROM some_user_table
WHERE the_id = '#UCASE(SESSION.the_id)#'
</cfquery>
<cfset o_some_user_oid = getUserByLdap.some_user_oid> <!---OK here--->
......
......
.....

But then it randomly break here...NullPointerException. It seem to say that o_some_user_oid is NULL.

<cfstoredproc procedure = "somestoredprocedure" dataSource = "somedatasource">
<cfprocparam type = "in" CFSQLType = "CF_SQL_NUMERIC" dbvarname="p_engineer_oid" value = "#o_some_user_oid#">
<cfprocresult name = "assigned_systems">
</cfstoredproc>

java.lang.NullPointerException
at macromedia.sequelink.ctxt.conn.ConnectionContext.setTransactionIsolation(Unknown Source)
at macromedia.jdbc.sequelink.SequeLinkImplConnection.setTransactionIsolation(Unknown Source)
at macromedia.jdbc.slbase.BaseConnection.setTransactionIsolation(Unknown Source)
at coldfusion.server.j2ee.sql.JRunConnection.setTransactionIsolation(JRunConnection.java:499)
at coldfusion.server.j2ee.sql.JRunConnection.clean(JRunConnection.java:229)
at coldfusion.server.j2ee.sql.pool.JDBCPool.returnConnection(JDBCPool.java:785)
at coldfusion.server.j2ee.sql.pool.JDBCPool.connectionErrorOccurred(JDBCPool.java:326)
at coldfusion.server.j2ee.sql.JRunConnection.sendErrorEvent(JRunConnection.java:317)
at coldfusion.server.j2ee.sql.JRunConnection.prepareCall(JRunConnection.java:376)
at coldfusion.server.j2ee.sql.JRunConnectionHandle.prepareCall(JRunConnectionHandle.java:79)
at coldfusion.sql.Executive.executeCall(Executive.java:548)
at coldfusion.sql.Executive.executeCall(Executive.java:532)
at coldfusion.sql.Executive.executeCall(Executive.java:492)
at coldfusion.sql.SqlImpl.executeCall(SqlImpl.java:320)
at coldfusion.tagext.sql.StoredProcTag.doEndTag(StoredProcTag.java:193)
............................
I went as far as trying to decompile a few of the class file in cfusion.jar source code and perform remote debug (Eclipse) but was unsuccessful because the line number of the decompiled code is not the same as the original.

This seem to be common problem for almost all kind of database so I don't think that your database is the problem.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2007 Jun 29, 2007
LATEST
ejazskp wrote:
>
> 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:\Inetpub\wwwroot\mysite\queries\qry_menu_contained_HTabs.cfm: line 1
>
> 1 : <cfquery name="HTabsd" datasource="#application.datasource#"
> dbname="#application.dbname#" username="#application.dbusername#"
> password="#application.dbpassword#">

dbname is deprecated. Remove it from your code and try again.

Jochem


--
Jochem van Dieten
Adobe Community Expert for ColdFusion
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources