Uploaded image for project: 'Lucee Development'
  1. LDEV-700

NOT YET FIXED! ServletException occurs when mapping is defined with custom CFML resource provider

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: New
    • Resolution: Fixed
    • Affects Version/s: 5.0.0.153, 4.5.3.003
    • Fix Version/s: 5.0.0.169
    • Labels:
    • Environment:

      Last tested on Lucee 5.0.0.153 express edition (and before with Lucee 4.5 and 5.0.0.098)

      Description

      I have created a CFML Resource Provider for the "blob storage" of Microsoft Azure, which is kind of the same thing as the S3 resource. See the (debug) version here: https://github.com/paulklinkenberg/lucee-azure-provider

      When I use this resource provider by adding a mapping to it in the lucee-web.xml.cfm, the web context does not start up anymore.
      lucee-web.xml.cfm:

      <cfLuceeConfiguration hspw="...." salt="......" version="5.0">
      	[....]
      	<resources>
      	    <resource-provider arguments="case-sensitive:true;" component="AzureBlobResourceProvider" scheme="azure"/>
      	</resources>
      	<mappings>
      		[...]
      		<mapping inspect-template="" physical="azure://2TWF6ODxxxxxxxxxxxxxx1h/Em97hJIvexxxxxxxxxxxxxxEGw==@myaccount.blob.core.windows.net/files" primary="physical" readonly="false" toplevel="true" virtual="/testmapping"/>
      	</mappings>
      	[....]
      </cfLuceeConfiguration>

      The error which is thrown for any call to the web context is:

      javax.servlet.ServletException
      	lucee.commons.io.res.type.cfml.CFMLResourceProvider.getCFC(CFMLResourceProvider.java:244)
      	lucee.commons.io.res.type.cfml.CFMLResourceProvider.callResourceRTE(CFMLResourceProvider.java:148)
      	lucee.commons.io.res.type.cfml.CFMLResourceProvider.getResource(CFMLResourceProvider.java:85)
      	lucee.commons.io.res.ResourcesImpl.getResource(ResourcesImpl.java:81)
      	lucee.runtime.config.ConfigImpl.getResource(ConfigImpl.java:2175)
      	lucee.runtime.config.ConfigWebUtil.getExistingResource(ConfigWebUtil.java:350)
      	lucee.runtime.MappingImpl.<init>(MappingImpl.java:136)
      	lucee.runtime.config.XMLConfigWebFactory.loadMappings(XMLConfigWebFactory.java:1529)
      	lucee.runtime.config.XMLConfigWebFactory.load(XMLConfigWebFactory.java:386)
      	lucee.runtime.config.XMLConfigWebFactory.newInstance(XMLConfigWebFactory.java:262)
      	lucee.runtime.engine.CFMLEngineImpl.loadJSPFactory(CFMLEngineImpl.java:439)
      	lucee.runtime.engine.CFMLEngineImpl.addServletConfig(CFMLEngineImpl.java:389)
      	lucee.loader.engine.CFMLEngineWrapper.addServletConfig(CFMLEngineWrapper.java:89)
      	lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:200)
      	lucee.loader.servlet.CFMLServlet.init(CFMLServlet.java:44)
      	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
      	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
      	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
      	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
      	org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
      	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556)
      	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513)
      	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	java.lang.Thread.run(Thread.java:745)

      A workaround for this, is to remove the mapping from the lucee-web.xml.cfm file, and add it on the fly for each request in Application.cfc, by using this.mappings.
      Unfortunately, that workaround only works if the resourceProvider.cfc file has been instantiated before the mapping is created, as can be seen in this example Application.cfc, or the test code at https://github.com/paulklinkenberg/lucee-azure-provider/blob/master/test/Application.cfc:

      component {
         this.name = "testing12";
      
         public function onRequestStart()
         {
            /* reload the page, if this was the very first request in this web context */
            if (structKeyExists(request, "reloadRequest")) {
               location url="#cgi.script_name#?#cgi.query_string#" addtoken="no";
            }
            addMappings();
         }
      
         public function onApplicationStart()
         {
            /* To make sure the azure mappings work, we first need to instantiate the main class */
            local.x = new AzureBlobResourceProvider();
            /* reload the page for the user */
            request.reloadRequest = 1;
         }
      
         private function addMappings() {
            this.mappings['/azuremapping'] = "azure://2TWF6ODM+mcGxxxxxxxxxxxxEm97hJIveatq@my-account.blob.core.windows.net/files";
         }
      }

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              frinky Paul Klinkenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: