我刚刚在Ubuntu 14.04 VM上设置了Tomcat 8,我无法http://[hostname]:8080/manager/html从浏览器访问Manager App .点击它后,我收到"403 Access Denied"错误.我正在运行Tomcat作为在配置文件中定义的服务/etc/init.d/tomcat8-dev.该错误消息表明Tomcat设置为最初只能从localhost访问,但由于它是托管VM,因此我无法在其上运行浏览器.
我已在tomcat-users.xml几个人推荐的文件中设置了一个用户.但是,我没有被提示为该用户提供凭据,我在默认页面上找不到任何类型的登录按钮.该文件目前看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<user username="(redacted)" password="(redacted)"
roles="manager-gui,manager-jmx,manager-status,manager-script"/>
</tomcat-users>
Run Code Online (Sandbox Code Playgroud)
在这里阅读了Tomcat文档页面后,我也尝试在其中添加<Valve />标签context.xml,如下所示:
<Context privileged="true" antiResourceLocking="false"
docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1" />
<!--Another valve for my local machine's IP-->
</Context>
Run Code Online (Sandbox Code Playgroud)
但是,一旦我设置privileged="true",当我使用浏览器连接到服务器时,无论后来提供的阀门如何,我都会得到一个空白的白页.
sudo service tomcat8-dev restart每当我做出更改时,我都会重启我的服务.
我根据我在这里和其他网站上发布的帖子尝试过的其他事情:
address="0.0.0.0"到标签server.xml内部<Connector />initctl …我构建了一个没有任何XML的java配置的Spring MVC应用程序.我可以在笔记本电脑上部署和启动应用程序,没有任何问题.但是当我尝试在我的testserver(tomcat 7)上部署我的应用程序时,我收到以下消息:
HTTP Status 404 - The requested resource (/[application context]/) is not available.
Run Code Online (Sandbox Code Playgroud)
我使用Eclipse Maven插件构建我的应用程序.是否可以在没有web.xml的情况下部署应用程序,如果没有,哪个是我真正需要的基本web.xml?
Maven WAR插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
WebAppInitializer:
@Order(value = 1)
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
}
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] { HibernateConfig.class, SecurityConfig.class, HibernateDaoConfig.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] { WebAppConfig.class };
}
@Override
protected String[] getServletMappings() {
return new …Run Code Online (Sandbox Code Playgroud)