Skip to main content
Participating Frequently
August 10, 2011
Question

String index out of range: -1 and cflogin

  • August 10, 2011
  • 4 replies
  • 10981 views

Hi all,

We just started getting a strange error on our development server that is not happening in our test and production servers.  I am getting the error message "String index out of range: -1" when using the <cflogin> tag in my Application.cfm.  We are running ColdFusion 9,0,1,274733 with the update level at hf901-00002.jar.  Our server is windows server 2003 and we use the multi-server configuration option when installing CF.  Our test and production servers are both updated to the same version and update level as well.  Anyone have any ideas and/or a fix for this issue?  I can't seem to find anyone else out there who has experienced this error when using <cflogin> (others were experiencing "String index out of range" but for different unrelated reasons).

I'm not sure if this makes a difference or not, but our development server also was recently updated with Microsoft .NET 4.0 (admins always like to test in dev/test before moving to production).  I was under the impression that these two application servers were separate.  They are on the same server, but we have been using .NET 1.1 and 2.0 on the same dev/test/prod server with ColdFusion for many years and have never had an issue before.  This is the only change that happened to this server before this error popped up.

Another interesting thing that also recently started happening is if I don't include "index.cfm" in the /CFIDE/Administrator/ URL I receive a .NET error instead of coldfusion, but including index.cfm works just fine.  I even have the default document for /CFIDE/ set to "index.cfm" in IIS 6.  I don't know if this is related or not to the other error, but this also only happens in the dev environment (test/prod function normally).

Any ideas?  I'm stuck at this point.

Thank you,

Jason

    This topic has been closed for replies.

    4 replies

    August 25, 2011

    Hi,

    Can you please share what headers are getting added in request when this error comes?

    Shilpi

    Adobe ColdFusion Team
    http://shilpikm.blogspot.com

    Jdogg5600Author
    Participating Frequently
    August 29, 2011

    Shilpi,

    The headers are:

    GetHttpResponseData() Values - struct

    Accept

    */*

    Accept-Encoding

    gzip, deflate

    Accept-Language

    en-us

    Authorization

    Negotiate

    Connection

    Keep-Alive

    Content-Length

    0

    UA-CPU

    x86

    User-Agent

    Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)

    We do use SSL as well, and there is some SSL information in there that I can send you in a PM if necessary.

    September 23, 2011

    Thanks for sharing the headers. We will look into this. For helping us reproduce the case here, Is it possible for you to share some details about set up and what kind of Authentication is set at web server level. It would be great if you can also give version number of the web server you are using.

    Shilpi

    Adobe ColdFusion Team
    http://shilpikm.blogspot.com

    BKBK
    Community Expert
    Community Expert
    August 20, 2011

    Jdogg5600,

    This might be pointing to conflict between the .NET settings on the particular Windows server and those of ColdFusion.  In Windows, follow the menu Control Panel => Administrative Tools => Services.  Stop or disable the ColdFusion .NET service. While you're still in the service interface, restart the ColdFusion service. Any luck now?

    Jdogg5600Author
    Participating Frequently
    August 22, 2011

    BKBK,

    I disabled the ColdFusion .NET service, re-started all other ColdFusion and IIS services, and had the same result.  I then tried re-booting the server completely, and I am still receiving the "String index out of range: -1" error when not including "index.cfm" in the URL.  I may end up having to re-build this server here soon.  My only fear here though is if this problem comes up again in the future, I won't know how to fix it and will have to re-build again, which is a bit time intensive.  Anything else I should try?

    It's looking like the problem may be something else on the server, possibly not even CF-related.  I just am not sure where else to look or what else to try at this point.

    BKBK
    Community Expert
    Community Expert
    August 23, 2011

    Jdogg5600 wrote:

    I disabled the ColdFusion .NET service, re-started all other ColdFusion and IIS services, and had the same result.  I then tried re-booting the server completely, and I am still receiving the "String index out of range: -1" error when not including "index.cfm" in the URL.  I may end up having to re-build this server here soon.  My only fear here though is if this problem comes up again in the future, I won't know how to fix it and will have to re-build again, which is a bit time intensive.  Anything else I should try?

    It's looking like the problem may be something else on the server, possibly not even CF-related.  I just am not sure where else to look or what else to try at this point.

    The probability of a bug is now high. However, it might indeed be Windows(IIS) related. Follow the steps in how to configure Coldfusion for IIS. Any joy?

    12Robots
    Participating Frequently
    August 15, 2011

    Is the page on the production server protected by IIS Password protection?

    Jdogg5600Author
    Participating Frequently
    August 15, 2011

    12Robots,

    As far as I know, it is not.  As far as password protection, the web-site is set up as an application in IIS, and uses only integrated authentication (anon and basic are unchecked).  The web-site is part of an IIS 6 application pool that runs as a domain account.

    The web-site that is exeriencing the problem is connected to an Oracle database, and that is why there is a need to use the <cflogin> and <cfloginuser> tags.  The only "login" that is required to access the site is the username/password combination for the user's Oracle database account.  One interesting scenario is if I include "index.cfm" in the URL, I no longer receive the error and the site behaves normally.

    How would I verify that the page is not protected by IIS password protection?  I can check on dev, test, and production servers with my current rights.

    12Robots
    Participating Frequently
    August 15, 2011

    Hopefully you have FireFox and the web developer toolbar. Go to Misc>>Clear Private Data>HTTP Authentication.

    Then refresh. If you get prompted for a user/password from the web server in a popup, then there is web server password protection in place

    BKBK
    Community Expert
    Community Expert
    August 13, 2011

    Switch debugging on. ColdFusion should then give you more information about the error.

    Jdogg5600Author
    Participating Frequently
    August 15, 2011

    I have debugging turned on.  The error message I receive is "String index out of range: -1" on line 8 of my Application.cfm file, which is simply "<cflogin>" and that's all.  What is also interesting is that this exact same code works on our test and production servers.  The only difference between the servers is our dev server now has .NET 4.0 installed, whereas test and production does not.  We also have to include the name of the ".cfm" page in all URLs for CF to work in dev, if we don't include somethine like "index.cfm" or "default.cfm" in the URL, we receive a .NET error message instead stating the resource can't be found (weird).  This is not the case for test and production.

    Here is the stack trace from the CF error message:

    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.substring(String.java:1937)
         at coldfusion.tagext.security.AuthenticateTag.doStartTag(AuthenticateTag.java:177)
         at cfApplication2ecfm1302590360.runPage(F:\inetpub\LocalWebApps\WFQA\webapproot\Application.cfm:8)
         at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
         at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
         at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
         at coldfusion.filter.CfincludeFilter.include(CfincludeFilter.java:33)
         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:94)
         at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
         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:46)
         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:200)
         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:286)
         at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
         at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
         at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
         at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    
    BKBK
    Community Expert
    Community Expert
    August 15, 2011

    Sounds like it could be a bug. In any case, let's see the values you use for the attributes applicationToken, cookieDomain and idletimeout. ColdFusion might be tripping on one of the values.