Manual install into Tomcat 9

Hi Everyone,

Hopefully I’ll do a decent job of explaining everything this time around.
I have taken over someone else’s work - so “I” have no history with it / have not seen it previously run.

We have a set of scripts that will create all the Amazon Infrastructure that we need to deploy our application to : This all works.

We have additional scripts that do our software installs and configuration and it is within these that I have hit an “interesting” snag, that I am hoping someone will be able to help with, in that;

The existing script;

  • Downloads the lucee{version] JAR and copies it to the server at;
    /opt/lucee/lucee-5.3.8.206 : by CURLing “http://release.lucee.org/rest/update/provider/loader/$LUCEE_VERSION
  • creates a symlink for /opt/lucee/current to the above directory.
  • installs JDK 11
  • installs Tomcat 9 (which installs Java 17)
  • Adds the Lucee servlet and mapping to web.xml
  • Adds a valve to server.xml for mod_cfml
  • Downloads mod_cfml-valve_v1.1.11.jar
  • creates a shared key
  • “sed’s” the shared key into server.xml
  • creates the directory /var/lib/tomcat/lucee-server
  • changes the owner group to “tomcat” / updates security
  • restarts the tomcat service

Then the script sits and waits for the /opt/lucee/config/server/lucee-server/context/ directory to show up.

Everything works - BUT for the last step.

I assume it is because the script is using a JAR and not a WAR, but like I said earlier - I have never seen this script before / or seen it work.

I have checked GIT and it shows that this script has ALWAYS had the JAR.

So I “think” I just need to change the JAR for a WAR - then (perhaps) some alter some directory locations (if needed).

But I wanted to doublecheck that there wasn’t something I was missing, whereby I could use the JAR like a WAR?

As always thanks!

Don’t forget to tell us about your stack!

OS: Amazon Linux 2 (centOs 7)
Java Version: Java 11 / 17
Tomcat Version: 9.0.58
Lucee Version: 5.3.8.206

Centos SElinux is it off?

Try
setenforce 0 #turn off SElinux temporarily

make sure “tomcat” can follow and use your symlink target

additinoally, have you tried to just manually create
/opt/lucee/config/server/lucee-server/context/ ?

Java 17 doesn’t work yet. 11 is recommended

Hi Everyone,

Thanks for the replies.
It was indeed a Java version issue.
AmazonLinux2 comes with java 18 installed.
using yum to uninstall java and then reinstall 11 didn’t work.
Because 18 is still present.

I got it around it by using
sudo alternatives --config java

There are commands to set the version and another to remove an entry from the available alternatives.

Once I had sorted out this - Tomcat used the JAR, to create the Lucee admin context.
Which is great that it is all working - but to me surprising… I thought it had to be a WAR.

Anyway - thanks very much for the help!

Gavin.

1 Like

I’d always try to run Tomcat with it’s own dedicated JDK. You just need to download and extract/unzipped a JDK of your choice. That way you can have the
that JDK sitting besides your Tomcat files and point to it within the setenv.sh. That doesn’t require any JDK installation on OS level using apt or whatever. It also won’,t need setting any OS environment variables for that Java. Also, you can simply update/patch that JDK by downloading another version and changing the path location of that JDK in the setenv.sh.

See this post "Unable to make public"... opens java.util.zip (Masa CMS) - #4 by andreas