我从docker运行Tomcat:
docker run -it --rm -p 8888:8080 -v /Users/laura/Desktop/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml:ro tomcat:8.0
我可以很好地访问Tomcat管理器。我已将我的.war文件复制到webapps目录,但Tomcat管理器在尝试访问时给了我404 ...在部署期间没有错误。
我也试过用.war mount:
直接运行它docker run -it --rm -p 8888:8080 -v /Users/laura/Desktop/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml:ro -v /Users/laura/Desktop/glossary.war:/usr/local/tomcat/webapps/glossary.war tomcat:8.0
使用以下输出:
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /docker-java-home/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
10-Nov-2017 23:49:05.890 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.47
10-Nov-2017 23:49:05.893 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 29 2017 13:46:41 UTC
10-Nov-2017 23:49:05.895 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.47.0
10-Nov-2017 23:49:05.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
10-Nov-2017 23:49:05.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.9.41-moby
10-Nov-2017 23:49:05.898 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
10-Nov-2017 23:49:05.899 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-7-openjdk-amd64/jre
10-Nov-2017 23:49:05.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.7.0_151-b01
10-Nov-2017 23:49:05.900 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
10-Nov-2017 23:49:05.901 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
10-Nov-2017 23:49:05.902 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
10-Nov-2017 23:49:05.904 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
10-Nov-2017 23:49:05.904 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
10-Nov-2017 23:49:05.905 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
10-Nov-2017 23:49:05.906 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
10-Nov-2017 23:49:05.906 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/usr/local/tomcat/endorsed
10-Nov-2017 23:49:05.907 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
10-Nov-2017 23:49:05.908 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
10-Nov-2017 23:49:05.908 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
10-Nov-2017 23:49:05.909 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.14 using APR version 1.5.1.
10-Nov-2017 23:49:05.910 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
10-Nov-2017 23:49:05.914 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.1.0f 25 May 2017)
10-Nov-2017 23:49:06.058 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
10-Nov-2017 23:49:06.077 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
10-Nov-2017 23:49:06.079 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 779 ms
10-Nov-2017 23:49:06.163 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
10-Nov-2017 23:49:06.164 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.47
10-Nov-2017 23:49:06.232 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /usr/local/tomcat/webapps/glossary.war
10-Nov-2017 23:49:17.411 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. 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.
10-Nov-2017 23:49:17.533 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /usr/local/tomcat/webapps/glossary.war has finished in 11,301 ms
10-Nov-2017 23:49:17.536 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/examples
10-Nov-2017 23:49:18.079 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/examples has finished in 543 ms
10-Nov-2017 23:49:18.080 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/host-manager
10-Nov-2017 23:49:18.120 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/host-manager has finished in 39 ms
10-Nov-2017 23:49:18.120 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/manager
10-Nov-2017 23:49:18.157 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/manager has finished in 37 ms
10-Nov-2017 23:49:18.158 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/docs
10-Nov-2017 23:49:18.183 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/docs has finished in 26 ms
10-Nov-2017 23:49:18.183 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/ROOT
10-Nov-2017 23:49:18.206 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/ROOT has finished in 23 ms
10-Nov-2017 23:49:18.215 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
10-Nov-2017 23:49:18.300 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
10-Nov-2017 23:49:18.407 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 12327 ms
然后我尝试在http://localhost:8888/glossary/访问它,但它失败了404。
以下是webapp目录的内容:
root@544c1d9f4a88:/usr/local/tomcat# ls -lh webapps/
total 147M
drwxr-xr-x 3 root root 4.0K Nov 4 21:32 ROOT
drwxr-xr-x 14 root root 4.0K Nov 4 21:32 docs
drwxr-xr-x 6 root root 4.0K Nov 4 21:32 examples
drwxr-xr-x 5 root root 4.0K Nov 10 23:05 glossary
-rwxr-xr-x 1 root root 147M Nov 10 23:05 glossary.war
drwxr-xr-x 5 root root 4.0K Nov 4 21:32 host-manager
drwxr-xr-x 5 root root 4.0K Nov 4 21:32 manager
非常感谢任何帮助!
ps:我也从docker运行Oracle,因为我的webapp使用它: docker run --name OracleXE --shm-size = 1g -p 1521:1521 -p 8080:8080 -v / Users / laura / Desktop / data:/ u01 / app / oracle / oradata -e ORACLE_ALLOW_REMOTE = true oracle / database :11.2.0.2-XE
答案 0 :(得分:0)
因为您可以访问tomcat实例和管理器应用程序,所以您应该能够看到部署了哪些应用程序,它们是否正在运行以及它们的上下文路径。 那么对词汇表有什么看法呢?您是否拥有使用应用程序上下文路径/词汇表部署和运行的应用程序? 您可以通过访问
下的Tomcat Manager应用程序来回答这些问题http://localhost:8080/manager/html(或您的特定主机和端口)
希望这有帮助!
您可以尝试的另一件事是将glossary.war重命名为ROOT.war。这将部署您的词汇表应用程序作为ROOT应用程序,它将直接在localhost:8080下访问(或者您运行tomcat的任何端口)。