Ethan
Ethan

Reputation: 11

Certain libraries cause Tomcat to fail to deploy

I'm just learning Tomcat, and have successfully deployed a simple test WAR to a Tomcat server. However, when I attempt to add a library via Maven, Tomcat's JarScanner then fails to load the class files for my program, saying it can't find anything

09-Feb-2020 05:36:42.568 INFO [http-nio-80-exec-8] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/tomcat/apache-tomcat-9.0.30/webapps/api.war]
09-Feb-2020 05:36:42.668 FINE [http-nio-80-exec-8] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
09-Feb-2020 05:36:42.686 INFO [http-nio-80-exec-8] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/apache-tomcat-9.0.30/webapps/api.war] has finished in [117] ms

However, if I remove the library from pom.xml (and hence from the WAR), it loads fine. Here are the libraries being loaded:

Further, I've already tried telling the JARScanner to not scan any JAR files, both in context.xml and in catalina.properties.

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\
*.jar
<JarScanner scanClassPath="false" scanAllDirectories="false" scanManifest="false" scanAllFiles="false"/>

Neither of these have resulted in the deployment working. If I don't exclude the main library (JDA), then Tomcat reports an ArrayIndexOutOfBounds exception. The server is running Tomcat 9 on JDK 8, as is my IDE.

Upvotes: 1

Views: 263

Answers (1)

Mark Bramnik
Mark Bramnik

Reputation: 42501

From your log snippet - it doesn't seem that the WAR wasn't deployed, actually it was (see the third line): Deployment of web application archive [/opt/tomcat/apache-tomcat-9.0.30/webapps/api.war] has finished in [117] ms

Try to compare this output with the output from the WAR that you think "is deployed" and the chances are that you'll see the same message (I don't have a tomcat right now to verify this on my machine, but that's my assumption).

The second line: No TLD files were found in resource path... basically means that there are no TLD files in the WAR which of course doesn't mean that the war has errors...

TLD stands for Tag Library Descriptor - its for JSP tags which are not a mandatory component in Web Archives.

See here some information about TLDs

Upvotes: 1

Related Questions