Hi. I do have some hurry on this, so thanks for the help.
I do have a website called website
.
In this site I call some cfc stored in other directory called componentesIA
.
From website
I can call to this CFC by a mapping on the server (servicios_ia
) like this: servicios_ia.ai_services.AIProviderFactory
But, the problem begins when AIProviderFactory
needs a component in his same or nested directory. Cant find it. For example, AIProviderFactory
needs to call GeminiProvider
which is stored in a subfolder of the component called ai_services
so I need to call like this: ai_services.GeminiProvider
.
The component won’t find ai_services
because (I think) the context is from the website, not the component.
I try to make an Application.cfc on the component, but it don’t get executed.
How can it be resolved?
Don’t forget to tell us about your stack!
OS: Windows
Java Version: 21
Tomcat Version: ???
Lucee Version: 6
@rodriciru , Please share any test code along with the stack trace so it is easy to trace.
This is the real folder structuture (in the first post i try to simplificate a bit):

This is the website code that calls to the cfc:
aiProviderFactory = new serviciosIA.ai_services.AIProviderFactory();
aiProvider = aiProviderFactory.createGeminiProvider("xxxxx");
Mapping /serviciosIA
points to the Application.cfc
directory.
So I can perfectly do the first code line. It works.
But the second line, internally, requires code from ai_services.gemini.provider.GeminiProvider
That won’t work. It won’t find the subdirectory ai_services
o make honour of the CFC Application.cfc
which defines a mapping per request:
this.mappings["/ai_services"] = expandPath("./ai_services");
CFC Application.cfc
is completely ignored at all if you call a cfc of this route (but i can see the compiled version of the Application.cfc
on the compiled folder class from server).
The error is :
"could not find component or class with name [ai_services.gemini.provider.GeminiProvider]"
Stack trace:
"lucee.runtime.exp.ApplicationException: could not find component or class with name [ai_services.gemini.provider.GeminiProvider]
at lucee.runtime.functions.other._CreateComponent.loadClass(_CreateComponent.java:161)
at lucee.runtime.functions.other._CreateComponent.call(_CreateComponent.java:70)
at ai_services.aiproviderfactory_cfc$cf.__luceedebug__udfCall(C:\Users\Rodrigo\CosasGit\ProyectosGit\CFLucee_Servicios_IA\ai_services\AIProviderFactory.cfc:39)
at ai_services.aiproviderfactory_cfc$cf.udfCall(C:\Users\Rodrigo\CosasGit\ProyectosGit\CFLucee_Servicios_IA\ai_services\AIProviderFactory.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:224)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:722)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:595)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:2101)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:773)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:2075)
at ia.accionesianoticia_cfc$cf.__luceedebug__udfCall(C:\Users\Rodrigo\CosasGit\ProyectosGit\CFLucee_Gestor_PromecalNews\ia\accionesianoticia.cfc:5)
at ia.accionesianoticia_cfc$cf.udfCall(C:\Users\Rodrigo\CosasGit\ProyectosGit\CFLucee_Gestor_PromecalNews\ia\accionesianoticia.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:224)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:722)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:595)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:2101)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:773)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:2075)
at noticias_ficha_cfm414$cf.__luceedebug__call(C:\Users\Rodrigo\CosasGit\ProyectosGit\CFLucee_Gestor_PromecalNews\Noticias.Ficha.cfm:108)
at noticias_ficha_cfm414$cf.call(C:\Users\Rodrigo\CosasGit\ProyectosGit\CFLucee_Gestor_PromecalNews\Noticias.Ficha.cfm)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1112)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1006)
at lucee.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:63)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:42)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2810)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2797)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2768)
at lucee.runtime.engine.Request.exe(Request.java:45)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1109)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1066)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:54)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at runwar.undertow.SSLCertHeaderHandler.handleRequest(SSLCertHeaderHandler.java:161)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:175)
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:69)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at runwar.undertow.WelcomeFileHandler.handleRequest(WelcomeFileHandler.java:49)
at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:104)
at runwar.undertow.SiteDeployment$1.handleRequest(SiteDeployment.java:169)
at io.undertow.predicate.PredicatesHandler.handleRequest(PredicatesHandler.java:141)
at io.undertow.server.handlers.DisallowedMethodsHandler.handleRequest(DisallowedMethodsHandler.java:62)
at io.undertow.predicate.PredicatesHandler.handleRequest(PredicatesHandler.java:113)
at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72)
at runwar.undertow.LifecyleHandler.handleRequest(LifecyleHandler.java:143)
at runwar.undertow.SiteDeployment$4.handleRequest(SiteDeployment.java:360)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:395)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:854)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: lucee.commons.lang.ClassException: cannot load class through its string name, because no definition for the class with the specified name [ai_services.gemini.provider.GeminiProvider] could be found
at lucee.commons.lang.ClassUtil.loadClass(ClassUtil.java:293)
at lucee.runtime.functions.other._CreateComponent.loadClass(_CreateComponent.java:158)
... 85 more
Caused by: java.lang.ClassNotFoundException: ai_services.gemini.provider.GeminiProvider
at lucee.commons.lang.PhysicalClassLoader.loadClass(PhysicalClassLoader.java:282)
at lucee.commons.lang.PhysicalClassLoader.loadClass(PhysicalClassLoader.java:211)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:534)
at java.base/java.lang.Class.forName(Class.java:513)
at lucee.commons.lang.ClassUtil$ClassLoaderBasedClassLoading.loadClass(ClassUtil.java:975)
at lucee.commons.lang.ClassUtil.__loadClass(ClassUtil.java:444)
at lucee.commons.lang.ClassUtil._loadClass(ClassUtil.java:428)
at lucee.commons.lang.ClassUtil.loadClass(ClassUtil.java:270)
... 86 more
"
Im using CommandBox, i dont know if it matters
Thanks
@rodriciru , The mapping ‘serviciosIA’ is configured at the server level, so it works as expected. However, the problem occurs when the code tries to use the ‘ai_services
’ mapping, which is defined in Application.cfc
using this.mapping
. The mapping defined in Application.cfc
is only honored for requests that originate within the application itself, and it is not recognized when accessed via a server-level mapping. Therefore, both ‘serviciosIA
’ and ‘ai_services
’ mappings should be configured at the server level
In that case, whats the point of defining how to find Application.cfc
in server mapping settings?