War File in Tomcat 8 Missing Resources when Removing Version Number

I have a front-end Nginx Plus server that proxies back .cfm files to a Tomcat server that runs the Lucee War file. It works great if I leave the version number at the back of the filename, but If I try to remove the version number and just have it deploy lucee.war (to make it easier to update in the future I can just redeploy without having to adjust my Nginx configuration every time) I lose all the styles, javascript’s etc. in the control panel as they just 404. So HTTP://tomcatserver:8080/lucee-5.2.8.206/lucee/admin/server.cfm works fine, but if I try to deploy it as HTTP://tomcat server:8080/lucee/lucee/admin/server.cfm all the stylesheets and CSS scripts 404 out.

Is there a way I can get it to deploy into tomcat without the version number?

Hmmm, I’d say you have also the directory “root” containg the version number added in your Ngnx comfiguration: You’d need to adapt that too to work without the version number so the static files are delivered directly via Ngnx. Can’t tell you more, cause I haven’t done much with Ngnx until today.

Ok so I’m bypassing the Nginx server and accessing the control panel directly from the Tomcat server, we have other applications running in Tomcat so I can’t dedicate it. But it is just strange that if I deploy the war file as it sits (ie lucee-5.3.8.206.war extracts to lucee-5.3.8.206 when I access the control panel directly everything works fine, it’s just when I remove that version number from the war file to lucee.war and then let Tomcat deploy it for some reason it can’t find the resources.
Maybe if someone can test this, maybe there is some cache Tomcat is doing but I’ve deleted all references and even rebooted this server and it still isn’t working.
If someone does test it, try it with just lucee.war first just in case there is some sort of caching going on, if I can see that it works for someone else then it’s not a Lucee issue.
Thank you!


(Won’t let me post two images, will reply to this with the second image)

There is something wrong.

This directory is too many:

image

It should be:

image

Are you making a package from scratch of lucee.war?

Because that package doesn’t expect there to be a root directory:

image

1 Like

I also think @Roberto_Marzialetti is correct. Maybe your war file is being deployed as an independent webapp, because you haven’t configured any ROOT location in your Tomcat configuration. Please read this article, it may help you:

https://www.baeldung.com/tomcat-root-application

In your specifc case and Lucee I’d try the third option: Create a file named ROOT.xml (it must be upper case!!!) at path-to-your-lucee-installation\tomcat\conf\Catalina\localhost with the following content:

<Context docBase="path-to-your-war-location/lucee.war"/>

And restart Tomcat… Then you should get rid of that additional path.

You may also need to create a config file ROOT.xml for your specifc domain at path-to-your-lucee-installation\tomcat\conf\Catalina\wwww.your-specific-domain.com

Update: Your quickest solution is very likely to just rename your lucee.war to ROOT.war.

Hey guys, happy Monday and thanks for answering. And this is correct, I’m not wanting to make Lucee the ‘ROOT’ application because there are multiple other applications on this Tomcat server besides Lucee. I am deliberately wanting to deploy Lucee as a separate app. Then in my frontend Nginx config I’m proxying back into this ‘app’ any ColdFusion page. I basically want to deploy it, in Tomcat, as just ‘Lucee’ and not ‘Lucee-5.3.8.206’ - If I deploy Lucee as is (with the version number) all the css and js resources show up fine, when I remove the version number from the war file and let Tomcat deploy it as simply ‘lucee’, all the resources 404 out.

For simplicities sake, I want to depoy it as Lucee and then update the war file as updates come out, then it’s just the “Lucee” app and not forever “lucee-5.3.8.206” so it won’t confuse whoever will be administering this in the future.

Alright, so, with just ‘lucee’ deployed, if I come in through the front-end ‘Nginx’ server all the resources show up. If I hit the Tomcat server directly the forms show up but there are no styles, javascripts, etc.

I guess I’ll just leave it, I really don’t want to be able to access the server/web admin areas directly from the front end web server (I want configuration only through the backend to prevent potential brute force attacks) – If I ever come up with the solution I will report back here, but for now I can deal with no styles, and if something requires javascript, I’ll just turn it on for the time necessary to access from the front end.

Thanks