Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ubuntu 14.04.1上的Apache tomcat7在部署war时出现404错误,在manager时出现401错误_Java_Apache_Tomcat_Ubuntu_War - Fatal编程技术网

Java ubuntu 14.04.1上的Apache tomcat7在部署war时出现404错误,在manager时出现401错误

Java ubuntu 14.04.1上的Apache tomcat7在部署war时出现404错误,在manager时出现401错误,java,apache,tomcat,ubuntu,war,Java,Apache,Tomcat,Ubuntu,War,我已经在ubuntu服务器上的tomcat7上部署了war。在点击ip:8080链接时,我成功地获得了tomcat7主页 如果这进一步有帮助,我已经按照给出的步骤进行了操作 因此,现在tomcat7是作为一项服务安装的。 为了部署war,我只需停止tomcat,然后将myapp.war文件放在webapps目录中。然后我启动了tomcat服务器。catalina的日志显示了以下内容(跳过不必要的行): 当我尝试访问ip:8080/myapp url时,这给了我404错误 然后我尝试下载适用于ap

我已经在ubuntu服务器上的tomcat7上部署了war。在点击ip:8080链接时,我成功地获得了tomcat7主页

如果这进一步有帮助,我已经按照给出的步骤进行了操作

因此,现在tomcat7是作为一项服务安装的。 为了部署war,我只需停止tomcat,然后将myapp.war文件放在webapps目录中。然后我启动了tomcat服务器。catalina的日志显示了以下内容(跳过不必要的行):

当我尝试访问ip:8080/myapp url时,这给了我404错误

然后我尝试下载适用于apache的windows二进制文件,然后将war放在webapps中,然后启动.bat(在另一台windows机器上)。这非常有效(因此证明war文件和/或其web.xml没有任何问题)。但只有在linux上,才会出现404问题。我看到了所有与类似问题相关的答案,其中大多数建议访问manager应用程序。所以我用sudoapt-get安装了manager应用程序。安装成功。但不幸的是,它在ip:8080/manager上显示了一个用户名和密码字段。 这需要修改tomcat-users.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.
-->
<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user name="tomcat" password="s3cret" roles="standard,manager-gui,admin-gui,tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

</tomcat-users>

我尝试输入tomcat7和s3cret作为凭据,但没有被接受,再次弹出询问用户名和密码的框。我不知道为什么会这样。从我的角度来看,似乎没有什么问题,因为这是安装tomcat和部署war文件的方法(这不是我第一次这么做),所以它也应该对我有用


请有人提供解决相同问题的指南。

我认为您应该将问题分为两部分,一部分用于应用程序部署,另一部分用于经理。这样你将有更好的机会得到好的答案。你应该检查日志中的stacktrace/错误消息/var/lib/tomcat7/logs/catalina.out似乎“标准”角色尚未定义。。。
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
May 12, 2015 3:44:01 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/myapp.war
May 12, 2015 3:44:18 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined
<?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.
-->
<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user name="tomcat" password="s3cret" roles="standard,manager-gui,admin-gui,tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

</tomcat-users>