Tomcat在浏览器中输入:http://localhost:8080/ 后默认打开tomcat的管理界面,但是项目发布以后不希望这样,希望输入该地址后,
显示你希望代开的项目,所以需要以下更改
具体如下:
找到Tomcat的安装路径,打开conf文件夹中的server.xml文件:加入
以下代码,为红色代码部分
<Context path="" debug="0" docBase="E:\javasoft\Tomcat 6.0(Tomcat 7.0)\webapps\默认打开你的项目名" />
修改后的server.xml文件为下面所示,经测试,6.0和7.0都没问题的。
<?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">
<!--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" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- 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"
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" />
<!-- 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="Standalone" 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"/>
-->
<!-- The request dumper valve dumps useful debugging information about
the request and response data received and sent by Tomcat.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- 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"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<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 -->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
<Context path="" debug="0" docBase="E:\javasoft\Tomcat 6.0(Tomcat 7.0)\webapps\默认打开你的项目名" />
</Host>
</Engine>
</Service>
</Server>
另一种方法,将项目拷贝到webapps下,并将项目名称改为ROOT;不过可能会出现路径问题。
相关推荐
2.在里面添加下面一句话 其中docBase为项目绝对路径,path为相对路径(相对于默认的webapps的路径) 此时使path为空,访问localhost即访问webapps也即访问docBase 打开安装目录下的bin文件找到startup.bat点开启动...
### Eclipse Tomcat Server 加载项目的详细步骤与配置 在开发Java Web应用时,Eclipse集成开发环境(IDE)因其强大的功能、丰富的插件支持以及友好的用户界面而被广泛使用。其中,Eclipse内置的Tomcat服务器是进行...
tomcat服务器的默认访问路径是webapps目录下的ROOT。如果更改tomcat服务器下的默认访问工程,需要修改tomcat/conf/server.xml配置文件。 打开server.xml可以找到类似下面的配置: unpackWARs=true autoDeploy=...
1. **打开配置文件**:编辑Tomcat的配置文件`conf/server.xml`。 2. **添加线程池**: ```xml maxThreads="500" minSpareThreads="20" maxIdleTime="60000" /> ``` - `maxThreads="500"`:最大线程数设为500。...
#### 三、方法一:直接替换Tomcat默认图标 **步骤**: 1. **定位文件**:打开已安装的Tomcat目录,进入`webapps\ROOT`目录。 - **路径示例**:`D:\tomcat\apache-tomcat-7.0.50-1\webapps\ROOT` 2. **替换文件**...
对于初学者来说,了解如何在Tomcat上部署项目是学习Java Web开发的重要步骤。以下是一份详细的Tomcat部署项目指南: 1. **安装Tomcat** - 首先,你需要下载Apache Tomcat的最新版本。访问官方网站`...
3. **配置环境变量**:设置CATALINA_HOME环境变量指向Tomcat的根目录。 4. **启动Tomcat**:打开命令行工具,进入到Tomcat的bin目录下,运行`startup.bat`(Windows)或`startup.sh`(Linux/MacOS)来启动服务。 ##...
### MyEclipse Tomcat 控制台乱码设置详解 在进行Web开发时,尤其是使用Java进行开发的过程中,经常遇到的一个问题就是控制台出现乱码。这种情况不仅会影响开发体验,还可能导致一些难以察觉的问题。本文将详细介绍...
总的来说,设置Tomcat访问默认项目是一个简单的过程,但理解其背后的机制对于有效管理Tomcat服务器上的多个应用至关重要。通过合理配置,你可以确保用户每次访问服务器时都能看到期望的默认界面。
- `debug`属性用于设置调试级别,默认为`0`。 - `privileged`属性决定了该上下文是否具有特殊权限,默认值为`true`。 3. **重启Tomcat服务器**: - 修改完成后,保存并关闭`server.xml`文件。 - 重启Tomcat...
点击“Finish”,STS将部署项目到Tomcat,并在浏览器中打开默认的欢迎页面。 要进行调试,需要在HelloWorldServlet的doGet方法上设置断点。然后再次运行项目,当请求到达断点时,STS会自动进入调试模式。你可以查看...
根据提供的文件信息,下面详细介绍在Tomcat7上部署多个Web项目的方法,这些知识点包括了配置文件的编辑、部署路径的管理以及特定开发环境下的项目结构调整。 首先,Tomcat作为一个应用服务器,用于托管Java Web应用...
启动Tomcat,浏览器访问`localhost:8080`,显示Tomcat默认主页则表示启动成功。 接着,对Web项目进行打包,通常是以WAR格式。在Eclipse中,右键选择项目,点击Export,然后选择Web项下的WAR file,指定保存位置,...
* 在 Tomcat 中,可以通过添加 welcome-file-list 来设置默认的主页配置。 * 在部署 Tomcat 项目时,需要确保 Tomcat 的安装目录和 JDK 的安装目录正确。 优缺点分析 方式一:通过 Myeclipse 软件中部署的优点是...
- 在弹出的窗口中,需要修改两个关键设置:将`Content Root`指向项目的根目录,而`Web Root`则应指向`src/main/webapp`目录,这是Tomcat默认查找静态资源(包括JSP)的位置。 - 完成这些配置后,IDEA会自动创建...
本文将详细介绍如何手动部署JBPM默认的示例项目至Tomcat服务器,并连接MySQL数据库的过程。JBPM是一个开源的工作流引擎,用于自动化业务流程。通过本文,您将了解到从下载JBPM开始,直至完成所有必要的配置步骤来...
6. 接下来,检查下方的“Deploy Path”设置,确保其值被设置为“webapps”,这是Tomcat默认的Web应用部署目录。 7. 修改完成后,关闭配置窗口并保存设置。 8. 最后,重新启动Tomcat服务器,现在访问`...
- 编码设置:在File > Settings (Preferences on macOS) > Editor > File Encodings中设置项目默认编码,通常推荐使用UTF-8。 - 编译环境设置:在File > Settings > Build, Execution, Deployment > Compiler > ...
打开Idea,进入 `File` -> `Settings` (或者在Mac上是 `IntelliJ IDEA` -> `Preferences`),然后在设置窗口左侧的导航栏选择 `Languages & Frameworks` -> `Servers`。点击右上角的 `+` 按钮添加新的服务器实例。 ...