zrhoffman commented on a change in pull request #6532: URL: https://github.com/apache/trafficcontrol/pull/6532#discussion_r799085958
########## File path: dev/traffic_router/run.sh ########## @@ -0,0 +1,41 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -o errexit + +cd "$TC/traffic_router" + +mvn -Dmaven.test.skip=true compile -P \!rpm-build +mvn -Dmaven.test.skip=true package -P \!rpm-build + +cp core/target/ROOT.war /opt/tomcat/webapps/ +ln -s $TC/dev/traffic_router/conf/* /opt/tomcat/conf/ + +/opt/tomcat/bin/catalina.sh jpda run Review comment: TR exits immediately after starting. The contents of `/opt/tomcat/logs/catalina.2022-02-04.log`: ```java 04-Feb-2022 00:41:39.532 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw exception java.lang.ClassNotFoundException: org.apache.traffic_control.traffic_router.tomcat.TomcatLifecycleListener at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:104) at org.apache.catalina.startup.ListenerCreateRule.begin(ListenerCreateRule.java:70) at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1293) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1377) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824) at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216) at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1551) at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:617) at org.apache.catalina.startup.Catalina.load(Catalina.java:709) at org.apache.catalina.startup.Catalina.load(Catalina.java:746) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:472) ``` So Tomcat cannot find `org.apache.traffic_control.traffic_router.tomcat.TomcatLifecycleListener`, which `server.xml` tells it to load: https://github.com/apache/trafficcontrol/blob/7b30bab1a6931927f092f78c74b5ad7b4f6ab8c0/dev/traffic_router/conf/server.xml#L21 That is because, aside from `ROOT.war`, the Traffic Router RPM includes an entire `lib` directory (which duplicates the `lib` directory contained in `ROOT.war`, which contains `traffic_router_connector-6.2.0.jar`, which contains `TomcatLifecycleListener.class`. https://github.com/apache/trafficcontrol/blob/abfbb3483afbb3deedb488e872d21d8c0ba6c94a/traffic_router/build/pom.xml#L188 In order for Tomcat to find `traffic_router_connector-6.2.0.jar` (and assuming the `CATALINA_BASE` environment variable is `${TC}/dev/traffic_router`), `${TC}/dev/traffic_router/lib` can be a relative symlink to `traffic_router/core/target/ROOT/WEB-INF/lib`, generated by `mvn compile`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
