我不太喜欢系统工程师(我是一名 Java 开发人员),并且我发现尝试理解是否存在一些困难雄猫我必须在其上部署应用程序的服务器(在远程服务器上)配置良好或者是否存在一些配置问题。
操作系统是Linux CentOS 版本 6.7(最终版)
我需要您的帮助来了解情况以及当我联系该服务器的系统管理员时我必须说些什么。
因此,要重新启动 Tomcat,我有以下语句:
sudo -i -u 项目名称
sudo 服务项目名称顶部 sudo 服务项目名称启动
首先,我必须打开一个与我必须部署的项目以及我必须启动的将托管该项目的 Tomcat 实例同名的用户(这些信息是由该服务器的系统管理员提供的)。
服务器似乎已启动,这是输出:
[projectname@servername webapps]$ sudo service projectname start
getsebool: SELinux is disabled
Using CATALINA_BASE: /usr/local/tomcat/projectname
Using CATALINA_HOME: /usr/local/tomcat/default
Using CATALINA_TMPDIR: /usr/local/tomcat/projectname/temp
Using JRE_HOME:
Using CLASSPATH: /usr/local/tomcat/default/bin/tomcat-juli.jar:/usr/local/tomcat/default/bin/bootstrap.jar
这网络应用程序文件夹应该包含已部署的应用程序,并且它似乎包含我必须部署的旧版本的应用程序:
[projectname@servername webapps]$ ls
ROOT ROOT.war
在哪里ROOT战争是我的应用程序的旧战争版本根目录似乎是这个 war 文件的分解版本。
问题是 Tomcat 似乎没有响应。尝试从浏览器打开此 URL(这是用于通过 SSH 连接的服务器地址):
http://myservername.hq.mycompany.org:8080/
我得到一个404错误。
因此,请遵循以下建议:
执行ps-ef | grep 汤姆猫我得到的声明:
[projectname@servername webapps]$ ps -ef | grep tomcat
projectname 8454 1 1 10:11 ? 00:00:06 /usr/local/jvm/default/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/projectname/conf /logging.properties -Xmx512m -Xms128m -XX:MaxPermSize=512m -XX:PermSize=256m -XX:+UseConcMarkSweepGC -Djava.util.logging.manager=org.apache .juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/default/endorsed -classpath /usr/local/tomcat/default/bin/tomcat-juli.ja r:/usr/local/tomcat/default/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat/projectname -Dcatalina.home=/usr/local/tomcat/default -Djava.io.tm pdir=/usr/local/tomcat/projectname/temp org.apache.catalina.startup.Bootstrap start
projectname 8488 8119 0 10:20 pts/0 00:00:00 grep tomcat
所以看起来服务器已经启动了。
但如果我执行netstat -a |查询 8080查看正在收听的内容8080端口我什么也没得到,这是我的输出:
[projectname@servername webapps]$ netstat -a | grep 8080
[projectname@hqldservername webapps]$
那么这意味着什么呢? Tomcat 不工作8080端口或者它可能配置错误? (因为它启动但不列出)。
这是本篇的内容/usr/local/tomcat/projectname/conf/server.xml配置文件:
<?xml version='1.0' encoding='utf-8'?>
<!--
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.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005"
shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<!--
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
-->
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
-->
<Connector port="8009"
protocol="AJP/1.3"
redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>
所以我有以下疑问,我需要一些解释才能正确地将问题暴露给我的系统管理员:
1)该服务器是否正确运行?
2) 是否上市8080港口?如果没有,它是否列在另一个端口上,或者可能正在运行但未列在任何端口上?
3) 的网络应用程序目录包含战争(在我的例子中ROOT战争)要部署的文件和分解的根目录是该文件的部署版本吗?还是在其他地方?
答案1
http://myservername.hq.mycompany.org:8080/
我收到 404 错误。
您所描述的一切都是正确的、预期的行为。 tomcat正在监听8080,否则你永远不会得到404。任何3xx、4xx、5xx和所有其他HTTP代码都来自服务器,因此TCP会话有效,因此连接/侦听/绑定都有效。
我认为你应该问管理员的是:
查看该界面的完整网址是什么? (有可能是http://myservername.hq.mycompany.org:8080/something.jsp.blahblahblah)
找出测试一些最小功能的基本流程(例如用于登录的用户和密码、执行一件事、查看一件事、注销)
规格:
汤姆猫看起来不错。
而不是
netstat -a
你应该做nestat -an
或更好netstat -lntp
甚至更好的现代ss -lntp
Tomcat 监听
webapps
子目录的更改。一旦你把它放在.war
那里,你应该期望 tomcat 开始自动部署它。如果 tomcat 已死亡,当它启动时,它将部署webapps
.没有其他应用程序商店。对于部署结果,请检查logs/catalina.out
和其他日志。
PS 许多应用程序对于成功部署也有“丑陋”的要求:始终停止 tomcat、删除 中的所有内容temp
、work
启动 tomcat。