Hi all,
I’m been playing around with running Lucee within embedded Tomcat with the intention to make a standalone and portable application, but I’m unable to get the lucee-server to point to the right directory.
Here’s a snippet of my Tomcat initialisation…
final String serverRootPath = new File(configProperties.getPropertyValue(Arguments.SERVER_ROOT_PATH)).getAbsolutePath();
ctx.getServletContext().getServletRegistrations().get(cfmlServletName).setInitParameter("lucee-web-directory", serverRootPath + "/WEB-INF");
ctx.getServletContext().getServletRegistrations().get(cfmlServletName).setInitParameter("lucee-server-directory", serverRootPath + "/lucee-server");
With the above, a ‘lucee-server’ directory is created so there’s clearly something in the CFML engine doing its thing, but then it doesn’t actually appear to use the directory for anything, and remains empty once started up.
Weirdly, redirecting the ‘lucee-web-directory’ works just fine and results in my WEB-INF folder appearing there.
I was able to locate the lucee-server directory by checking the pageContext, and it appears to be running from my Gradle caching directory, which makes sense as I have the Lucee jar as a dependency in my build.gradle, retrieved from maven central.
C:\Users\mahdo\.gradle\caches\modules-2\files-2.1\org.lucee\lucee\lucee-server\context
To code is available here if you need more context.
https://github.com/valley-fordham/lucee-server/blob/master/src/main/java/com/glenfordham/webserver/TomcatServer.java
Everything otherwise works correctly!
edit: I also tried this…
System.setProperty("lucee.server.dir", serverRootPath + "/lucee-server");
…which had the exact same result as the above. ‘lucee-server’ folder was created but wasn’t used.
Anyone have any idea how I can get it redirecting correctly? I went back to a Lucee version from several years ago and the same thing happened, so I wonder if embedded Tomcat isn’t completely supported, or if I’m just doing something dumb.
Don’t forget to tell us about your stack!
OS: Windows 10 64bit
Java Version: Java 14.01
Tomcat Version: 9.0.41
Lucee Version: 5.3.7.47
Thanks all.
Glen