Right after starting a lucee server we sometimes g...
# box-products
b
Right after starting a lucee server we sometimes get this error:
Message: java.lang.reflect.InvocationTargetException while creating an instance of ortus.extension.cache.redis.RedisCache
any idea what could cause this?
b
@birdy1980 Is there a stack trace to go with it?
And does it seem to prevent the Redis cache from working?
b
Oh sorry, here is the stacktrace.
lucee.runtime.exp.NativeException: java.lang.reflect.InvocationTargetException while creating an instance of ortus.extension.cache.redis.RedisCache at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) at lucee.commons.lang.ClassUtil.newInstance(ClassUtil.java:950) at lucee.commons.lang.ClassUtil.loadInstance(ClassUtil.java:385) at lucee.runtime.cache.CacheConnectionImpl.getInstance(CacheConnectionImpl.java:65) at lucee.runtime.cache.ServerCacheConnection.getInstance(ServerCacheConnection.java:62) at lucee.runtime.cache.CacheUtil.getCache(CacheUtil.java:124) at lucee.runtime.cache.CacheUtil.getCache(CacheUtil.java:113) at lucee.runtime.functions.cache.CacheClear._call(CacheClear.java:109) at lucee.runtime.functions.cache.CacheClear.call(CacheClear.java:65) at lucee.runtime.functions.cache.CacheRemoveAll.call(CacheRemoveAll.java:37) at deviant.common.utils.caching_cfc$cf$7d.udfCall1(/nl/deviant/common/utils/Caching.cfc:88) at deviant.common.utils.caching_cfc$cf$7d.udfCall(/nl/deviant/common/utils/Caching.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:697) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:585) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1932) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1765) at tools.show_cache_usage_cfm$cf$8g.call(/tools/show_cache_usage.cfm:48) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1046) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:938) at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:919) at applicationbase_cfc$cf$3.udfCall1(/ApplicationBase.cfc:264) at applicationbase_cfc$cf$3.udfCall(/ApplicationBase.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:697) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:585) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1932) at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:444) at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:218) at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44) at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2482) at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2468) at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2439) at lucee.runtime.engine.Request.exe(Request.java:45) at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1198) at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1144) at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97) at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51) 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:47) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) 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 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.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852) 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:1280) at java.base/java.lang.Thread.run(Unknown Source) Caused by: lucee.commons.lang.ClassException: java.lang.reflect.InvocationTargetException while creating an instance of ortus.extension.cache.redis.RedisCache ... 86 more
The situation when it happens: on our ci server we stop the IIS sie and the lucee instance. wait for the instance to be realley stopped using the command
box server status name=ci property=status
new code gets deployed. we start lucee we call a status cfm page on localhost to check if the application has started. It's a .cfm file with "OK" as content. then we start the iis site. then we call a .cfm page with the purpose to clear the cache items. For now the error seems to happen on the line that clears the query cache
cacheRemoveAll("QUERY");
Before that the "OBJECT" cache and 3 custom cache regions have already been cleared
l
Could be chicken and the egg. Our extension is a loaded at the mercy of lucee
b
@birdy1980 Just checking, that's the FULL trace, all the way to the bottom?
I want to make sure there are no more "caused by" bits at the end
That error seems to be coming from Lucee itself
The code that is throwing the error is not from our extension
I would guess Lucee hasn't loaded the OSGI bundles properly, but it's hard to say
There could be another related exception that is causing the failure that is not getting logged.
I'm not really sure what
InvocationTargetException while creating an instance of xx
really means in this case
Can you check the logs for any previous errors-- sometimes when a class can't be created (the constructor errors), the JVM will throw a less helpful message and not even try on all subsequent attempts.
That could be what's happening here, and the "real" error could be up above in your logs (if it was loggeed)
b
I have just run into the issue on my dev machine. I can verify that I posted the full stacktrace. I'll loop up the log files to see if there are any previous errors.
weird. in the application.log I see 4 lines after a restart of lucee "INFO","XNIO-1 task-1","08/05/2022","133438","application","Redis Cache [userinfo] accepted, connection built and ready to rock" "INFO","XNIO-1 task-1","08/05/2022","133438","application","Redis Cache [statistics] accepted, connection built and ready to rock" "INFO","XNIO-1 task-1","08/05/2022","133438","application","Redis Cache [methodinfo] accepted, connection built and ready to rock" "INFO","XNIO-1 task-1","08/05/2022","133438","application","Redis Cache [OBJECT] accepted, connection built and ready to rock" I'm missing the line that should sat "Redis Cache [QUERY] ready..." The invocation error happens on the the line where we want to clear the query cache.
Also when I run a page twice with a queryExecute , with a cachedWithin parameter, and dump the result. the second time it says the query was cached, but I don't see a new item in Redis. It looks like the query cache connection was not created.