Skip to main content
Participant
Nov 19, 2021 8:38 PM UTC
Question

Coldfusion command line

 

Hello,

 

while running below command - getting error - “java.lang.NullPointerException” 

Please see attachment of screenshot

 

queryExecute ("SELECT * FROM test WHERE id = :id", { id=1, cfsqltype="cf_sql_integer" },{ datasource="creditapp" });

    This topic is closed to new replies. Start a new post to keep the conversation going.

    9 replies

    BKBK
    Community Expert
    Community Expert
    Nov 20, 2021 12:08 PM UTC

    I could reproduce it as well. 

    (My set-up: ColdFusion 2021 Update 2, running on JDK 11.0.13)

     

     

     

    Translate
    BKBK
    Community Expert
    Community Expert
    Nov 20, 2021 12:27 PM UTC

    Yet another CLI/REPL test that results in a NullPointerException:

    /* Application.cfc located in same directory as test15.cfm */
    component {
        this.name = "AppName";
        this.datasource = "cfml_db";
        this.sessionManagement = true;
    
        boolean function onApplicationStart() {
           return true;
        }
    
     }
    
    <1--- test15.cfm --->
    <cfscript>
    	x=queryExecute ("SELECT * FROM animals WHERE id = :id", { id=1, cfsqltype="cf_sql_integer" },{ datasource="cfmx_db" });
    	writedump(x);
    </cfscript>
    
    

     

    CLI result:

     

    Translate
    BKBK
    Community Expert
    Community Expert
    Nov 21, 2021 11:28 AM UTC

    I have reported a bug: https://tracker.adobe.com/#/view/CF-4212570 

    Translate
    Charlie Arehart
    Community Expert
    Community Expert
    Nov 19, 2021 9:20 PM UTC

    Have you confirmed first that a simple single variable assignment works? How about a simpler sql statement, without the queryparam?

     

    And what cf version are you running? And what update level? That will help folks see if they get the same problem. (Of course, they'd not have your database.)

     

    I'll assume also that the dsn you name is defined in the cf admin of the instance whose CLI you're running. Have you confirmed also that just running that code in a cfscript block of a regular cfm page (requested by a browser or the cf.bat file) does work?

     

    Breaking your problem into pieces is the way to solve things like this, which you think "should just work". Only after exhausting such possibilities might it be time to wonder if there's a bug in cf. 

    Translate
    /Charlie (troubleshooter, carehart. org)