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

The local variable application cannot be declared outside of a function.

Participant ,
May 27, 2016 May 27, 2016

Copy link to clipboard

Copied

I was receiving an ORA-936 on an application I support (Oracle 11g, CF 11, Windows Server 2012).  The database went down yesterday, for a reason unknown to me, and when it came up, I am now getting this error message.  The only pointer to the .cfm file is the referrer.  I don't see how to fix this one.  What information can I include that will help you help me?  It seems like the more I learn, something new always comes up.   Here's the error page that was displayed.  I have not changed any declarations, that I know of.   Thank you.

The local variable application cannot be declared outside of a function.

All variables defined with the var keyword must be declared inside a function.

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 NT 6.1; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0

Remote Address       108.44.188.221

Referrer       https://TestServer/secure/Requirement/requirementsum.cfm?frompage=orig&CFID=58847&CFTOKEN=1c45276fd6...

Date/Time       27-May-16 01:25 PM

Stack Trace

coldfusion.compiler.ASTvariableDefinition$InvalidVarDefinition: The local variable application cannot be declared outside of a function.

    at coldfusion.compiler.ASTvariableDefinition.register(ASTvariableDefinition.java:98)

    at coldfusion.compiler.SemanticAnalyzer.transform(SemanticAnalyzer.java:340)

    at coldfusion.compiler.Treewalker.postorder(Treewalker.java:100)

    at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)

    at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)

    at coldfusion.compiler.NeoTranslator.parseAndTransform(NeoTranslator.java:443)

    at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:370)

    at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:147)

    at coldfusion.runtime.TemplateClassLoader$TemplateCache$1.fetch(TemplateClassLoader.java:436)

    at coldfusion.util.LruCache.get(LruCache.java:180)

    at coldfusion.runtime.TemplateClassLoader$TemplateCache.fetchSerial(TemplateClassLoader.java:362)

    at coldfusion.util.AbstractCache.fetch(AbstractCache.java:58)

    at coldfusion.util.SoftCache.get_statsOff(SoftCache.java:133)

    at coldfusion.util.SoftCache.get(SoftCache.java:81)

    at coldfusion.runtime.TemplateClassLoader.findClass(TemplateClassLoader.java:609)

    at coldfusion.filter.PathFilter.invoke(PathFilter.java:101)

    at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)

    at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79)

    at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)

    at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)

    at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)

    at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)

    at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)

    at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)

    at coldfusion.CfmServlet.service(CfmServlet.java:219)

    at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)

    at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:437)

    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:197)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)

    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:722)

Views

2.8K

Translate

Translate

Report

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

correct answers 1 Correct answer

Participant , Jun 24, 2016 Jun 24, 2016

I had added end marks to all the <cfset tags in the Application.cfc (<cfset ..... />  and it cleared up.  Weird.

So that brings me to another question.  When do you do the end tag like that or use the </cfset> tag?

Votes

Translate

Translate
LEGEND ,
Jun 22, 2016 Jun 22, 2016

Copy link to clipboard

Copied

The reason I asked about the SAN is because I've heard of issues with the SAN causing the database to take an inordinate amount of time to return data, resulting in dropped connections, connections reset by peer, and other issues.  Might be worth looking into - although if you're environment is anything like mine, prepare for everyone else to say "It's not us." 

V/r,

^_^

Votes

Translate

Translate

Report

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
Participant ,
Jun 22, 2016 Jun 22, 2016

Copy link to clipboard

Copied

That's exactly what the Gov't SysAdmin and DBA say.  On more than one occasion, I have had to do more digging to prove it was indeed their problem and even had to tell them how to fix it.  Sad but true.   However, I think this may be my problem.

Votes

Translate

Translate

Report

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
Participant ,
Jun 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

Now I am getting an error message telling me the <cffunction> for the error routine must have a corresponding  end tag.  If you look in the example, it does.  My Expression Web 4 editor finds it when I select Find Matching Tag.   Is this another case of something else could be messed up?  (i.e. - missing end tag for another cf tag, missing comment end tag, etc.)

Thanx.

Votes

Translate

Translate

Report

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 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

Most likely what is happening is that something is breaking within the onError() function, which ends the process before the closing </cffunction> tag is processed.  It might make things a bit confusing, but you could put a CFTRY/CFCATCH in there to email a CFDUMP of the CFCATCH and display a generic error message.  Just remember that all code must be placed after any CFARGUMENT tags.

HTH,

^_^

Votes

Translate

Translate

Report

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
Participant ,
Jun 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

I had added end marks to all the <cfset tags in the Application.cfc (<cfset ..... />  and it cleared up.  Weird.

So that brings me to another question.  When do you do the end tag like that or use the </cfset> tag?

Votes

Translate

Translate

Report

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 24, 2016 Jun 24, 2016

Copy link to clipboard

Copied

LATEST

<cfset /> doesn't have an end tag.  Kind of like "The Highlander", there can be only one. 

<cfset variables.varName = "Some Value" /> or <cfset variables.varName = "Some Value"> are both correct, really.  But there is no body for cfset, so <cfset variables.varName = "Some Value"></cfset> is incorrect and will not work.

Now.. there is CFCONTENT, if you will, which _does_ have a body, and does essentially the same thing as <cfset>, but it's really for setting more than just a line of value - you can format a page and fill it with all kinds of data, and save it to a variable.

<cfcontent name="variables.varName">

<table>

  <tr>   

    <td>Column One Row One</td>

    <td>Column Two Row One</td>

  </tr>

  <tr>

    <td>Column One Row Two</td>

    <td>Column Two Row Two</td>

  </tr>

</table>

</cfcontent>

HTH,

^_^

UPDATE:  I just noticed that your onError() has CFCONTENT in it, and it's used exactly as I just described.. so.. n/m. LOL

Votes

Translate

Translate

Report

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 08, 2016 Jun 08, 2016

Copy link to clipboard

Copied

"var application" is not the only possible "local" reference, "local.application" does the same.

Votes

Translate

Translate

Report

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
Documentation