Skip to main content
Participating Frequently
October 2, 2007
Question

[CF8] java.lang.NullPointerException

  • October 2, 2007
  • 48 replies
  • 51636 views
Hello,

On my CF8 web host, I sometimes get strange java.lang.nullpointerexceptions errors. All my code works flawless since the year 2000. The same pages do work but sometimes, maybe 1 out of 30 try's, the error appears again. First I thought it was a session problem or a problem with Application.cfm. But I stripped those down and it even happens with simple queries. I think it has to do with queries or MySQL 5.

Has anyone encountered this error? The system says "The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code." But I have all my values defined and it is not a programming error. It is more like a server configuration error I guess.



The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
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.
500

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:1229)
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 cfhetkoor2ecfm251397670.runPage(E:\westlandkoorconcordia.nl\wwwroot\hetkoor.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:192)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:366)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


javax.servlet.ServletException: 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:1229)
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 cfhetkoor2ecfm251397670.runPage(E:\westlandkoorconcordia.nl\wwwroot\hetkoor.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:192)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:366)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:70)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code. Text
    This topic has been closed for replies.

    48 replies

    Known Participant
    February 1, 2012

    Quite a simple problem, just got to coldfusion administrator, click on the datasource, click on show advanced settings, uncheck maintain connections. and you have banished the problem forever.

    Participating Frequently
    April 18, 2011
    I've experienced this error after upgrading MySQL from 4 to 5

    I've put together this small article on how to temporarily fix it until a hot fix is released from Adobe:

    http://www.thebluepipe.com/Developer/tutorials/coldfusion/coldfusion-mysql-5-fix
    ing-the-system-has-attempted.html


    I hope it helps

    Participant
    April 15, 2011

    I am suffering from this same problem.  I am receiving all sorts of random, disturbing errors, and after realizing that all the stacktraces started the same way, I found myself here.

    All the errors start like this: java.lang.NullPointerException at com.mysql.jdbc.Statement.setMaxRows(Statement.java:2178)

    Is anyone aware of any reliable fix for this??


    Thanks,

    Brian

    Participating Frequently
    April 15, 2011

    Have you tried tweaking all the timeout settings (both on the CF and MySQL side) as suggested in any of the prior posts?

    Failing that, please provide more information:

    * OS/version

    * CF version (and any/all updaters and hotfixes applied)

    * code snippet

    * exact exception/stack information

    Or if you don't feel like doing any of that, try a clean re-installation of ColdFusion. I know it sounds dramatic, but sometimes it's the easiest way out.

    steve

    Participant
    April 18, 2011

    Thank you for the response Steve.  I wasn't able to tweak those settings (being on a shared host), but after I contacted my shared host, they moved my site to a CF9 server and since then I have stopped seeing that issue.  I guess it's only a bug in CF8.

    Best,

    Brian

    Participant
    September 27, 2010

    Hi I am working on an application which requires integration with Twitter. I have used twitter4j api,n when i tried to run the server and client it is giving the following error.  Can you help me get through this.

    [Thread-4] INFO  twitter4j.internal.logging.Logger - Will use class

    twitter4j.internal.logging.SLF4JLoggerFactory as logging factory.

    14:20:48.375 [Thread-4] INFO  t.internal.http.HttpClientFactory - Will use twitt

    er4j.internal.http.alternative.HttpClientImpl as HttpClient implementation.

    14:20:48.531 [Thread-4] DEBUG twitter4j.http.OAuthAuthorization - OAuth base str

    ing: POST&http%3A%2F%2Fapi.twitter.com%2F1%2Fdirect_messages%2Fnew.json&oauth_co

    nsumer_key%3D2n2xvpH3gK1gjAawipnDw%26oauth_nonce%3D-385779984%26oauth_signature_

    method%3DHMAC-SHA1%26oauth_timestamp%3D1285568448%26oauth_token%3D180266706-lOs2

    Jj46bXBTsKJaQiE4XMM0Vj3z6Jslg5UgpEVS%26oauth_version%3D1.0%26screen_name%3Dpifi3

    %26text%3Daaa

    java.lang.NullPointerException

            at twitter4j.internal.http.BASE64Encoder.encode(BASE64Encoder.java:46)

            at twitter4j.http.OAuthAuthorization.generateSignature(OAuthAuthorizatio

    n.java:321)

            at twitter4j.http.OAuthAuthorization.generateAuthorizationHeader(OAuthAu

    thorization.java:216)

            at twitter4j.http.OAuthAuthorization.generateAuthorizationHeader(OAuthAu

    thorization.java:257)

            at twitter4j.http.OAuthAuthorization.getAuthorizationHeader(OAuthAuthori

    zation.java:95)

            at twitter4j.internal.http.alternative.HttpClientImpl.request(HttpClient

    Impl.java:166)

            at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.j

    ava:72)

            at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java

    :103)

            at twitter4j.Twitter.sendDirectMessage(Twitter.java:964)

            at multiverse.org.mxr.qri.server.util.TwitterIntegration1.SendChatMessag

    e(TwitterIntegration1.java:55)

            at multiverse.org.mxr.qri.server.service.impl.GiftSendService.process(Gi

    ftSendService.java:127)

            at multiverse.org.mxr.qri.server.service.impl.GiftSendService.<init>(Gif

    tSendService.java:41)

            at multiverse.org.mxr.qri.server.util.MessageRouter.run(MessageRouter.ja

    va:40)

    Participating Frequently
    October 5, 2010

    Shrutipriya-

    Please start a new thread - this is not at all related to the topic the others were talking about.

    Also, if you haven't gone too far with your solution, I highly recommend using the monkehTweet project to connect to Twitter from ColdFusion. Open source, works great (using it on a project now) and really easy to work with.  http://monkehtweet.riaforge.org/

    Steve

    Participant
    July 7, 2010

    We finally figured this out on our box.  Turns out that we had set the maxtimeout on the mysql box low for some other applications we have running against it.  So, when we configured the timeout for each datasource to be less than the maxtimeout on the mysql box, all was well. set mysql max timeout = 60 seconds...datasource timeouts at 58 seconds.  obviously, you can configure as you see fit, we figured at the one minute point someone was throwing the keyboard anyway. ;-)

    Inspiring
    February 25, 2010

    I wanted to resurrect this old post because I have a client that is seeing this error on a site and he's tried moving it to CF9 and is getting the same error. It does generally occur on the same query, but it's a pretty simply update statement, the only variable in the query is definitely not null (verified in an error dump), the same code runs fine on many other sites without issue. But we are seeing this on a regular basis:

    java.lang.NullPointerException at com.mysql.jdbc.Statement.setMaxRows(Statement.java:2178) at coldfusion.sql.Executive.executeQuery(Executive.java:1267) at coldfusion.sql.Executive.executeQuery(Executive.java:1009) at coldfusion.sql.Executive.executeQuery(Executive.java:940) at coldfusion.sql.SqlImpl.execute(SqlImpl.java:325) at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:838) at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:528)

    Has anyone found a solution for this?

    Inspiring
    February 25, 2010

    Oops, small correction. It does appear the setMaxRows issue was indeed corrected in CF9 and we're now getting the underlying error that caused that one to occur on CF8. We haven't yet figured it out yet but does appear to be something that's causing a null exception...I've got enough information on the exact steps that recreate it so should be able to track it down.

    Participant
    June 18, 2010

    We're suffering from the same issue; unfortunately none of the suggestions in this thread have done anything for us. I have created a detailed explanation of the symptoms in my blog at http://devbox.computec.de/2010/06/coldfusion-8-and-mysql-5-1-via-jdbc-help-needed/. Is there any news or any other suggestions to get CF8 and MySQL 5.1 to play nice?

    Participant
    September 16, 2009

    Has a solution to this bug been created?  I am receiving the same random error when we upgraded to CF8 from CF7.  Please help...

    Server Product  ColdFusion 
    Version  8,0,1,195765   
    Edition  Standard   
    Java Version  1.6.0_04   
    Java Vendor  Sun Microsystems Inc.   
    Java Vendor URL  http://java.sun.com/   
    Java Home  C:\ColdFusion8\runtime\jre   
    Driver  SeeFusion (MySQL5) - mysql-connector-java-commercial-5.0.5-bin.jar, seefusion.jar

    BKBK
    Community Expert
    Community Expert
    May 27, 2009

    I have an idea. Coldfusion 8 has a new setting in the Administrator for MySQL datasources. It is the checkbox field, "Validation query". My idea is that it has something to do with this particular NullPointerException.

    To my knowledge, no one yet knows what is responsible for the broken connection. Is it the database driver, the database itself or an external influence such as a firewall? However, we know one thing for sure. When the current connection drops, the driver makes no attempt to get a new connection from the connection pool. That led me to the following hypothesis about how Coldfusion 8 and the MySQL driver work together:

    1) if the current connection fails the Validation Query must run

    and

    2) if the Validation Query fails, no new connection is obtained from the connection pool; instead, an exception is silently thrown.

    That could then explain the NullPointerException. By default, the Validation Query field is empty. If, for whatever reason, the database connection is broken then, by my hypothesis, the validation query is run. This fails, for the query is nonexistent. As a result, no new connection is obtained from the connection pool. Instead, an exception is silently thrown.

    Participating Frequently
    November 22, 2008
    Sorry about the 3 posts but the forum website is acting strangely. pete
    yogonaiseAuthor
    Participating Frequently
    November 22, 2008
    Ofcourse it is acting strangely, it is written in ColdFusion.
    Inspiring
    November 22, 2008
    Hello yogonaise,

    Instead of ??????

    > Ofcourse it is acting strangely, it is written in ColdFusion.
    >


    Participating Frequently
    November 22, 2008
    Sorry about the 3 posts but the forum website is acting strangely. pete