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

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

Participant ,
May 27, 2016 May 27, 2016

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)

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

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?

Translate
Engaged ,
May 27, 2016 May 27, 2016

Look for a variable outside a function that has the var keyword in front of it.  It may be in an included file or custom tag that is being called by requirementsum.cfm if you don't find it in there.

HTH,

--Dave

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

I've gone through the CF code numerous times; both the requirementssum.cfm and another .cfm file it includes and don't see anything in CF like that.  However, there is a bunch of Java/Javascript embedded and it has numerous var assignments.

Is there a way I can narrow the error down?   If I didn't mention it earlier, I'm an Oracle DBA and had the CF stuff thrust upon me.   I'm sure it's much simpler than it seems.

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

If you have an IDE that can do "site-wide" source code searches (like DreamWeaver), do a site-wide search for "var " (not including the quotation marks; just the word var with a space after) and see if that pops something up for you to view.

The error message _sounds_ as if the code is trying to init a variable called "application" (which we all know would be a "Bozo No-No" seeing as how that is an actual scope).  Maybe someone meant to declare a variable in the application scope and forgot to include the ".varName" portion??  The issue might be in your application.cfc/.cfm file.  (shrug)

In any case, it would seem that the db going down may have upset the application scope variables, and when the service re-started it blew up.  Just my two cents.

HTH,

^_^

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

I use Expression Web 4.  I have a copy of Dreamweaver, but it's from my old job and my computer guys don't like me to put stuff on my laptop...  therefore, I used AstroGrep and found 2250 occurrences.  The only one I found with application is

var application.datasource.

.No other references.  I have yet to go through all the occurrences, but will report back if I find the issue.  Right now... it's still as mysterious as it was before.  I am going to have the gov't SysAdmin turn on debugging in CF Admin to see if I can find anything else.   Thank you.

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

Another thought would be to put a CFTRY/CFCATCH within the onRequest of your application.cfc and have the CFCATCH email you a CFDUMP of the CFCATCH object (just remember to put the opening CFTRY _after_ any arguments within the function.)

HTH,

^_^

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

I'll have to brush up on that.   I tried it previously and it didn't work correctly.  Thanx.

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

Pretty simple, really.

<cffunction name="onRequest" returntype="void">

  <cfargument name="thePage" type="string" required="true" />

  <cftry>

    <cfinclude template="#arguments.thePage#" />

  <cfcatch>

    <cfmail type="html" from="#anemailaddress#" to="#youremailaddress#" subject="ERROR!!  THE SKY IS FALLING!!!">

    <cfdump var="#cfcatch#" />

    </cfmail>

  </cfcatch>

  </cftry>

</cffunction>

HTH,

^_^

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

Thank you.  Your example made sense and I was able to insert it into my Application.cfc.   I FTP'd it to the test environment and brought up the application.  Nothing appeared to change, however, my e-mail notices have been delayed from the server up to 12 hours or more later.  Thank you for the tip.  I will post results when I get them.

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

Well, the e-mail notification from the server showed up on Sunday while I was on leave.  I just got back and it was waiting in my inbox.  The error was weird...

java.sql.SQLException: [Macromedia][Oracle JDBC Driver][Oracle]ORA-02396: exceeded maximum idle time, please connect again at macromedia.jdbc.oraclebase.ddcr.b(Unknown Source) 

The correct datasource is spelled out in the stack trace.  What can't it find?  What have I done wrong?

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

Different topic. Start a new thread and you'll probably get quicker responses. Plus you might want to add more details as I don't think I could reliably diagnose from that little snippet.

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

But it was in response to my results from the cfcatch/cftry suggestion from WolfShade on 6/6.  Is that still a new topic?  Here's the full error received.

ErrorCode    2396

Message    [Macromedia][Oracle JDBC Driver][Oracle]ORA-02396: exceeded maximum idle time, please connect again

SQLState    HY000

StackTrace    java.sql.SQLException: [Macromedia][Oracle JDBC Driver][Oracle]ORA-02396: exceeded maximum idle time, please connect again at macromedia.jdbc.oraclebase.ddcr.b(Unknown Source) at macromedia.jdbc.oraclebase.ddcr.a(Unknown Source) at macromedia.jdbc.oraclebase.ddcq.b(Unknown Source) at macromedia.jdbc.oraclebase.ddcq.a(Unknown Source) at macromedia.jdbc.oracle.ddal.a(Unknown Source) at macromedia.jdbc.oracle.ddal.a(Unknown Source) at macromedia.jdbc.oracle.ddam.t(Unknown Source) at macromedia.jdbc.oraclebase.dde3.w(Unknown Source) at macromedia.jdbc.oraclebase.dde3.s(Unknown Source) at macromedia.jdbc.oraclebase.dde3.execute(Unknown Source) at coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:359) at coldfusion.sql.Executive.executeQuery(Executive.java:1451) at coldfusion.sql.Executive.executeQuery(Executive.java:1201) at coldfusion.sql.Executive.executeQuery(Executive.java:1131) at coldfusion.sql.SqlImpl.execute(SqlImpl.java:406) at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:1059) at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:688) at cfwedtFirst2ecfm1610912140.runPage(\\52tayz-ws-004v\Testdata\Sites\SAF\IE\WEDT\BMT_New\secure\wedtFirst.cfm:76) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:446) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2795) at cfApplication2ecfc158086648$funcONREQUEST.runFunction(\\52tayz-ws-004v\Testdata\Sites\SAF\IE\WEDT\BMT_New\secure\Application.cfc:32) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414) at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:108) at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:300) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:426) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:112) 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)

Suppressed    array [empty]

TagContext    array

1    struct

COLUMN    0

ID    CFQUERY

LINE    76

RAW_TRACE    at cfwedtFirst2ecfm1610912140.runPage(\\Testdata\Sites\New\secure\wedtFirst.cfm:76)

TEMPLATE    \\Testdata\Sites\New\secure\wedtFirst.cfm

TYPE    CFML

2    struct

COLUMN    0

ID    CFINCLUDE

LINE    32

RAW_TRACE    at cfApplication2ecfc158086648$funcONREQUEST.runFunction(\\Testdata\Sites\New\secure\Application.cfc:32)

TEMPLATE    \\Testdata\Sites\New\secure\Application.cfc

TYPE    CFML

Type    java.sql.SQLException

SQLState    HY000

Sql    SELECT count(*) as count FROM admin_loginmessage WHERE messagegroup = 'Tool Administrator' AND trunc(sysdate) >= startdate AND trunc(sysdate) <= expirationdate

StackTrace    coldfusion.tagext.sql.QueryTag$DatabaseQueryException: Error Executing Database Query. at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:739) at cfwedtFirst2ecfm1610912140.runPage(\\52tayz-ws-004v\Testdata\Sites\SAF\IE\WEDT\BMT_New\secure\wedtFirst.cfm:76) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:446) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2795) at cfApplication2ecfc158086648$funcONREQUEST.runFunction(\\52tayz-ws-004v\Testdata\Sites\SAF\IE\WEDT\BMT_New\secure\Application.cfc:32) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414) at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:108) at coldfusion.runtime.AppEventInvoker.onRequest(AppEventInvoker.java:300) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:426) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:112) 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) Caused by: java.sql.SQLException: [Macromedia][Oracle JDBC Driver][Oracle]ORA-02396: exceeded maximum idle time, please connect again at macromedia.jdbc.oraclebase.ddcr.b(Unknown Source) at macromedia.jdbc.oraclebase.ddcr.a(Unknown Source) at macromedia.jdbc.oraclebase.ddcq.b(Unknown Source) at macromedia.jdbc.oraclebase.ddcq.a(Unknown Source) at macromedia.jdbc.oracle.ddal.a(Unknown Source) at macromedia.jdbc.oracle.ddal.a(Unknown Source) at macromedia.jdbc.oracle.ddam.t(Unknown Source) at macromedia.jdbc.oraclebase.dde3.w(Unknown Source) at macromedia.jdbc.oraclebase.dde3.s(Unknown Source) at macromedia.jdbc.oraclebase.dde3.execute(Unknown Source) at coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:359) at coldfusion.sql.Executive.executeQuery(Executive.java:1451) at coldfusion.sql.Executive.executeQuery(Executive.java:1201) at coldfusion.sql.Executive.executeQuery(Executive.java:1131) at coldfusion.sql.SqlImpl.execute(SqlImpl.java:406) at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:1059) at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:688) ... 50 more

Suppressed    array [empty]

TagContext    array

1    struct

COLUMN    0

ID    CFQUERY

LINE    76

RAW_TRACE    at cfwedtFirst2ecfm1610912140.runPage(\\Testdata\Sites\New\secure\wedtFirst.cfm:76)

TEMPLATE    \\Testdata\Sites\New\secure\wedtFirst.cfm

TYPE    CFML

2    struct

COLUMN    0

ID    CFINCLUDE

LINE    32

RAW_TRACE    at cfApplication2ecfc158086648$funcONREQUEST.runFunction(\\Testdata\Sites\New\secure\Application.cfc:32)

TEMPLATE    \\Testdata\Sites\New\secure\Application.cfc

TYPE    CFML

Type    Database

queryError    [Macromedia][Oracle JDBC Driver][Oracle]ORA-02396: exceeded maximum idle time, please connect again

where    [empty string]

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

The error message keeps referring to line 76 of wedtFirst.cfm.  I'm assuming that is probably the last line of a query?

If it's timing out, it could be the database itself; it could be the network (any recent changes?); if the database is stored on a SAN, it could be that.

V/r,

^_^

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

I saw that, but it didn't make sense.  Here's lines 74-77 of wedtfirst.cfm:

    <!---Login Popup Screen message--->

     <cfquery name="mCount" datasource="#application.datasource#">

          SELECT count(*) as count FROM admin_loginmessage WHERE messagegroup = '#session.UserLevel#' AND trunc(sysdate) >= startdate AND trunc(sysdate) <= expirationdate

     </cfquery>

application.datasource is assigned in Application.cfc.   The database and code function fine for every other option on the application but this one, at least they did when I originally posted about this one.  The SysAdmin and DBA say they have made no changes.

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

This is going to be a long shot, but..

Try adding the schema name to the beginning of the table name.

SELECT count(*) as count

FROM schemaName.admin_loginmessage

WHERE messagegroup = '#session.UserLevel#'

Also, I would avoid two things, here.  One - don't use reserved words for ANYTHING (like 'count') except where they are supposed to be used; and two - don't use asterisks for grabbing all the column names, as that forces the database to reference a system table in order to know what the column names are.  Use just one column name for that table, and you'll get your count.  Just my two cents. 

HTH,

^_^

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

Yep, I have had those suggestions before, but haven't had time to go through and redo all the mess I inherited.  However, I will attempt to fix this issue and hopefully it won't come up with another.

1. Fully qualifying is good practice, but it is not used at all in any of the code and the other code works fine.  The schema/user/datasource are all the same name.  The Gov't DBA suggested, when I started this process, that we just create the new database as a user in the existing database.  It has caused me no end of grief, but it's too late to modify it all now, so patching is in my future.

2. I forgot about the * thing!   That makes a ton more sense.  When you look at a big pile of code you inherit, you tend to not pay attention to the forest, but just the trees that are giving you trouble.   I will make your suggested changes and report back.

Thanx!

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

Yeah, I know how it is.. fix one, break three; fix three, break 28.  Especially with the legacy code that I inherited.. the previous lead developer went down every rabbit-hole he could think of.  SMH.

Fully qualifying and using aliases for table names has become my standard.  I like to think of it as "pre-emptive disambiguation".

V/r,

^_^

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

Amen.  This whole mess started when it couldn't find the datasource.  The only one declared was this.datasource.  I changed it to application.datasource and most of the application worked correctly.  Now we're going through and finding all the other dirty little secrets.   Cellophane toilet paper...  definitely.

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

I still have yet to receive the e-mail notification.  Not sure what is up with that.  I still get the generic "The local variable application cannot be declared outside of a function."  error page..  Anything else I can do to find out what is up?  Is there a way to change what is displayed on the error page?  I would just wait for the notification, but the customer is breathing down my neck.   I have requested the SysAdmin check the queue to see if something was in there for me, but have yet to receive a response.  On top of that, the server is down for "emergency" updates and such, until tomorrow at 0600.  Just didn't want to sit around waiting if I could be doing something else.  Thanx

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

I have two functions in my application.cfc: onMissingTemplate() and onError().

In the onError() function you can have it display a custom error message page, then email you a CFDUMP of the error message struct.  Have the mail server admins set up a generic-named email account just for this purpose, and give you access to it.  Something like "ErrReport@domain.com" or "dev@domain.com".

Ditto for the onMissingTemplate.  The downside to this is that these will work ONLY for CF errors.  If you want web server errors, then you need to create custom pages for that, as well, and set it up in your webserver (IIS or Apache or whatever you're using).

The good thing, here, is that as long as you don't include the error message on the custom page, hackers/attackers won't be able to gain the valuable information regarding your environment/schema that they are looking for in order to penetrate your systems.  I code ALL of my applications in this way.

HTH,

^_^

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

I'll have to check that out.  BTW, I found that all my error messages were going into the server's spam folder and were never sent out.  The tech just sent them to me.  The one from last week still referenced the line 76 in wetfirst.cfm.  The follow on messages referenced requirementsum.cfm line 46.  So, as long as I get e-mails, I can work through until I find the next one.   I can do a search to find examples of the functions you've mentioned to see format?   Thank you.

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

I tried looking around on Google - not much luck as far as examples go.  But I'll keep my eyes open.

V/r,

^_^

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

The message changes the module and line number, but the overall message remains the same: [Macromedia][Oracle JDBC Driver][Oracle]ORA-02396: exceeded maximum idle time, please connect again

Not sure why I'm getting the timeout.

Here's the OnError currently in my Application.cfc

<cffunction name="OnError" access="public" returntype="void" output="true" hint="Fires when an exception occures that is not caught by a try/catch block">

    <cfargument name="exception" type="any" required="true">

    <cfargument name="eventName" type="string" required="true">

    <cfset var errortext = "">

    <cfset var redirectUrl= "../index.cfm">

    <cfset application.datasource="MyDB">

    <cfif arguments.exception.rootCause eq "coldfusion.runtime.AbortException">

        <cfreturn/>

    </cfif>

    <!---<cflog file="#this.name#_ErrorLog" text="#arguments.exception.message#">---->

        <cfsavecontent variable="errortext">

        <cfoutput>

            An error occurred: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />

            Time: #dateFormat(now(), "short")# #timeFormat(now(), "short")#<br />

        </cfoutput>

        <cfdump var="#arguments.exception#" label="Error">

        <cfdump var="#form#" label="Form">

        <cfdump var="#url#" label="URL">

       </cfsavecontent>

        <cfquery name="getID" datasource="#application.datasource#">

            SELECT ERR_SEQ.NEXTVAL AS newID FROM dual

         </cfquery>

        <cfset NewErrorNumber=getID.newID>

        <cfquery datasource="#application.datasource#" >

            INSERT INTO ERR_LOG (ERR_ID ,ERR_DETAIL ,SECUREUSERID ,UPTIME,ERR_INFO  )

            VALUES (#NewErrorNumber#,'#left(arguments.exception.message,4000)#',#session.secureUserID# ,sysdate,<cfqueryparam value="#errortext#" cfsqltype="cf_sql_clob"/> )

        </cfquery>

         <cfmail to = "#application.DeveloperEmailList#" from = "HelpDesk@here.there" subject = "(Error ID: #NewErrorNumber#) App Error: #left(arguments.exception.message,100)#..." type="html">

            <table><tr><td width="536">

            This message is auto-generated by the AppApplication.  Please do not reply to this message. Given below are the details of the error that has been reported:

            </td>

            </tr></table>

            <table width="100%">

            <tr><td width="20%" style="word-break:break-all"><b>Error Number:</b></td>

            <td width="80%" style="word-break:break-all"> #NewErrorNumber#</td>

            </tr> 

            <tr><td><b>Submitted By:</b></td>

            <td style="word-break:break-all">   #session.userName#</td>

            </tr> 

            <tr><td><b>Submittor Email:</b></td>

            <td style="word-break:break-all">   #session.email#</td>

            </tr>   

            <tr><td><b>Brief Description:</b></td>

            <td style="word-break:break-all">An error occurred: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />

            Time: #dateFormat(now(), "short")# #timeFormat(now(), "short")#</td>

            </tr> 

            <tr><td valign="top"><b>Detailed Description:</b></td>

            <td style="word-break:break-all"><cfdump var="#arguments.exception#" expand="yes" showudfs="yes" label="Error" output="browser" format="text" metainfo="yes"></td>

            </tr>

            <tr><td valign="top"><b>Url Variables:</b></td>

            <td style="word-break:break-all"><cfdump var="#form#" expand="yes" showudfs="yes" label="Error" output="browser" format="text" metainfo="yes"></td>

            </tr>

            <tr><td valign="top"><b>Form Variables:</b></td>

            <td style="word-break:break-all"><cfdump var="#url#" expand="yes" showudfs="yes" label="Error" output="browser" format="text" metainfo="yes"></td>

            </tr>     

            </table>

        </cfmail>

        <cfoutput>

                <p>App has experienced an error. App Administrators have been notified and will coordinate with you in resolving the error.</p><p>Error #NewErrorNumber# - #arguments.exception.message#</p>

        </cfoutput>

</cffunction>

I don't have a onMissingTemplate() section.

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

That's a pretty solid onError() function!  I do have one question, though.  Is the datasource name _really_ "MyDB"?  Coz that's what the error function is setting it to, but I thought it was something else.  And why (just out of curiosity) would you re-set the datasource name in the application scope in an error situation, anyway? 

The timeout is the concern.  If the error function is changing the datasource name to something else that isn't in CFAdmin, that might be part of the problem.  But if that isn't the problem, the issue still looks like it's coming from the connection to the database.  Does the database (not the server. the data structure, et al) reside on a SAN??

V/r,

^_^

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

So my predecessors were good in their error functions?  Good to know.   No, MyDB is not the datasource.  My customer gets crazy when I publish exact directories and datasource names, so I change all that before I post.  I've slipped a few times, but tried to make sure it is changed.   In this instance, it was the actual datasource name and not application.datasource which is assigned earlier in Application.cfc

I believe the DB resides on a SAN, but the gov't DBA and SysAdmin aren't very forthcoming with that information.  It seems to me, in some meeting, that was mentioned, but my SysAdmin (for my company) was there, so I didn't pay attention.  He said he created my new development database server to mirror theirs and it resides on a SAN.   Hope this helps.

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