Tomcat 可以工作,但无法访问 http://localhost:8080/
当我从 Windows 托盘运行 Tomcat 时,它会启动,但我无法访问 http://localhost:8080/
Tomcat 主页,但如果我从 Eclipse 运行它,它就能工作,我的应用程序也能工作,但我无法访问http://localhost:8080/
...
如何解决?还是正常的?
谢谢!
When I run Tomcat from the windows tray, it starts and I can't reach http://localhost:8080/
Tomcat homepage, but if I run it from Eclipse, it works, my applications works, but I can't reach the http://localhost:8080/
...
How to solve it? Or is it normal?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据此线程,这可能是正常的:
请注意,这是针对使用 WTP x1.5 的 tomcat 版本(似乎是 tomcat 5 或更低版本),在使用 WTP(Web 工具平台)x2.0 及更高版本的 tomcat 中,您不再获得该选项。相反,您需要进入服务器属性并点击切换位置,然后它将显示正确的路径。然后进入服务器配置(双击服务器打开配置)并将“服务器位置”更改为“使用 Tomcat 安装”(中间的)。
This maybe normal, according to this thread:
Note this is for tomcat versions that use WTP x1.5 (seems to be tomcat 5 or below), in tomcat with WTP(Web tools platform) x2.0 and above you no longer get that option. Instead you need to go into server properties and hit switch location which will then show a proper path. then you go into the server config (double clicking the server opens config) and change the "Server Location" to "use Tomcat instillation" (the middle one).2
理解Web应用程序结构
Web应用程序是Web资源的集合,例如JSP页面、HTML页面、servlet、
和配置文件,组织成 Servlet 规范中指定的层次结构。你
有两种组织 Web 应用程序的方式:打包和解包。包装形式
称为网络归档(WAR)文件,解压后的形式是存储的目录集合
在文件系统上。
未打包的格式对于 Web 应用程序开发人员来说很方便,因为它允许他们
在开发和调试应用程序时替换单个文件。
但是,在部署环境中,提供单个文件通常更方便
可以自动部署。这减少了放置文件和
设置系统资源。 Tomcat还可以自动扩展Web应用程序一次
服务器已启动。 WAR文件的自动扩展在server.xml中配置
文件作为配置主机的元素的一部分。
Web 应用程序上下文
每个 Web 应用程序都对应一个上下文组件,如第 1 章中所述,并且
您为每个分配一个上下文路径。默认上下文称为 ROOT,对应于
没有其他上下文信息的服务器名称。例如,ROOT Web 应用程序
在本地计算机上将对应于
http://localhost:8080。
如果您已配置域您的服务器的名称系统 (DNS) 设置,也可以从某个位置进行访问,例如
用户通过请求与服务器相关的上下文来访问其他 Web 应用程序。为了
例如,用户可以使用以下 URL 访问 Tomcat 的管理器 Web 应用程序:
放置在 webapps 文件夹中的应用程序以它们所在的目录命名。
因此,您可以使用以下命令访问 tomcat-docs 目录中的 Web 应用程序:
http://localhost:8080/tomcat-docs.
服务器上的每个应用程序都通过其名称来识别,用户可以根据统一资源定位符的剩余部分来访问资源
Web 应用程序名称后的 (URL)。
Understanding Web Application Structure
A web application is a collection of web resources, such as JSP pages, HTML pages, servlets,
and configuration files, organized into a hierarchy as specified in the Servlet specification. You
have two ways in which to organize a web application: packed and unpacked. The packed form
is called a web archive (WAR) file, and the unpacked form is a collection of directories stored
on the file system.
The unpackaged format is convenient for web application developers, as it allows them to
replace individual files while the application is being developed and debugged.
However, in a deployment environment, it’s often more convenient to provide a single file
that can be automatically deployed. This reduces the deployment process to placing the file and
setting up system resources. Tomcat can also automatically expand a web application once
the server has booted. The automatic expansion of WAR files is configured in the server.xml
file as part of the element that configures hosts.
Web Application Context
Each web application corresponds to a context component, as discussed in Chapter 1, and
you assign a context path to each. The default context is called ROOT and corresponds to the
name of the server with no other context information. For example, the ROOT web application
on your local machine will correspond to
http://localhost:8080.
If you’ve configured DomainName System (DNS) settings for your server, it may also be accessible from a location such as
Users access other web applications by requesting a context relative to the server. For
example, users can access Tomcat’s manager web application with the following URL:
Applications that you place in the webapps folder are named after the directory they’re in.
So, you can access the web application in the tomcat-docs directory with the following:
http://localhost:8080/tomcat-docs.
Each application on the server is known by its name,and users can access resources according to the remainder of the uniform resource locator
(URL) after the web application’s name.