Question

The following code works on Adobe ColdFusion 9.01+ but not Railo 4.1

Furthermore, this only fails on Post

This code is called inside of FW/1 setupRequest() in application.cfc

<cfthread name="threadA" action="run"> 

<cftry>

<cfquery>
    INSERT
    INTO    dbo.Traffic (Circuit, Fuseaction, IP_hash)
    VALUES  (<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#listfirst(variables.rc.fuseaction, '.')#">,
        <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#listlast(variables.rc.fuseaction, '.')#">,
        <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#cgi.remote_addr#">
        )
</cfquery>


<cfcatch />
</cftry>

</cfthread>

Error

java.lang.NullPointerException at railo.runtime.net.http.HttpUtil.cloneParameters(HttpUtil.java:66):66 at railo.runtime.net.http.HttpServletRequestDummy.clone(HttpServletRequestDummy.java:677):677 at railo.runtime.thread.ThreadUtil.cloneHttpServletRequest(ThreadUtil.java:67):67 at railo.runtime.thread.ThreadUtil.clonePageContext(ThreadUtil.java:29):29 at railo.runtime.thread.ChildThreadImpl.(ChildThreadImpl.java:101):101 at railo.runtime.tag.ThreadTag.register(ThreadTag.java:269):269 at scorecard38.application_cfc$cf.udfCall(D:\railo\webapps\www\Scorecard38\Application.cfc:162):162 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:94):94

Wild Guess

variables.rc is not getting copied into the thread

Was it helpful?

Solution

variables.rc will not be copied into the thread unless you add it as an argument. Add rc as an argument and then instead of variables.rc you'll access it via arguments.rc

<cfthread name="threadA" action="run" rc="#variables.rc#">
  <cftry>

    <cfquery>
    INSERT INTO dbo.Traffic (Circuit, Fuseaction, IP_hash)
    VALUES  (<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#listfirst(arguments.rc.fuseaction, '.')#">,
    <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#listlast(arguments.rc.fuseaction, '.')#">,
    <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#cgi.remote_addr#">
    )
    </cfquery>

    <cfcatch />
  </cftry>

</cfthread>

If that doesn't work you'll have to remove the try/catch and dump out your cfthread to see the error. The code below will output 'Variable C is undefined'

<cfthread name="threadA" action="run">
  <cfset b = c>
</cfthread>
<cfdump var="#cfthread#"><cfabort>

OTHER TIPS

I had the same problem s you. You are using CGI varaible and that's what is causing the problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top