Pages

Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts

Heroku Web App Basic setting

Shopping list for setting up a Java EE Web App to be deployed on Heroku.

Assuming Maven, Java 11, Tomcat 9 as web server.

pom.xml: execution

Add to the build - plugins - plugin for maven-dependency-plugin, in the executions

<execution>
<phase>package</phase>
<goals>
  <goal>copy</goal>
</goals>
<configuration>
  <artifactItems>
	<artifactItem>
	  <groupId>com.heroku</groupId>
	  <artifactId>webapp-runner</artifactId>
	  <version>9.0.41.0</version>
	  <destFileName>webapp-runner.jar</destFileName>
	</artifactItem>
  </artifactItems>
</configuration>
</execution>

The element "version" is the Tomcat version we want to use

System properties

Root level, the system.properties should specify the Java version

java.runtime.version=11

Procfile

A one-liner, I split it here to improve readability

web: java $JAVA_OPTS
        -jar target/dependency/webapp-runner.jar
        --port $PORT target/*.war

Go to the full post

At least one JAR was scanned for TLDs yet contained no TLDs

As soon as I added a jar to my Tomcat base web application, I got this new info log message.
INFO [main] org.apache.jasper.servlet.TldScanner.scanJars
At least one JAR was scanned for TLDs yet contained no TLDs
It makes sense, since it was a JDBC driver, and I would have been very surprised if it contained a TLD.

Let's see how to get rid of it.

Firstly, I read the rest of the logging message
Enable debug logging for this logger for a complete list
of JARs that were scanned but no TLDs were found in them.
Skipping unneeded JARs during scanning can
improve startup time and JSP compilation time.
Actually, I already knew the name of the JAR culprit, since I just added it, so I could have skipped directly to the second step. However, I followed the instructions and ...

Tomcat logging properties

I (temporarily) changed the logging.properties for my Tomcat instance, adding this line
org.apache.jasper.servlet.TldScanner.level = FINE

After that, my log file got more interesting, and I focused my attention to this line.
FINE [main] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan
No TLD files were found in [... x.jar] Consider adding the
JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip
property in CATALINA_BASE/conf/catalina.properties file.
Very clear indeed.

Tomcat Catalina properties

I easily found the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in file catalina.properties from my Tomcat configuration folder. It is a longish comma separated string containing a list of JAR that are known not to contain TLD.

I just added the name of my JAR to it, and the case was closed.

Go to the full post