奇怪的 Tomcat 和 Axis Web 服务行为
我使用 Apache Axis 在 tomcat 上部署了一个简单的 Web 服务。
如果我以 http://localhost:8080/webservices/TransactionService 访问 Web 服务,我会看到通常的消息
交易服务
您好,这是 AXIS 服务!
也许这里会有一个调用服务的表单...
显示 Web 服务可用并可供使用。
但是,如果我将其访问为 http://10.0.0.1:8080/webservices/TransactionService ( 10.0.0.1 是机器的实际 IP,我在与上面相同的机器上访问它,机器托管 tomcat)我得到:
HTTP 状态 404 - /webservices/TransactionService
-------------------------------------------------------- ------------------------------------------------
类型:状态报告
消息: /webservices/TransactionService
描述:请求的资源 (/webservices/TransactionService) 不可用。
-------------------------------------------------------- ------------------------------------------------
Apache Tomcat/5.5
有tomcat 日志中没有任何内容
如果我尝试在 Jetty 上部署,一切正常。
对此有什么解释吗? 欢迎任何指点。
I have a simple web service deployed on tomcat using Apache Axis.
If i access the webservice as http://localhost:8080/webservices/TransactionService i see the usual message
TransactionService
Hi there, this is an AXIS service!
Perhaps there will be a form for invoking the service here...
showing that the web service is available and ready for use.
However if i access it as http://10.0.0.1:8080/webservices/TransactionService (10.0.0.1 is the actual IP of the machine. I'm accessing it on the same machine as above, machine hosting tomcat) i get:
HTTP Status 404 - /webservices/TransactionService
--------------------------------------------------------------------------------
type: Status report
message: /webservices/TransactionService
description: The requested resource (/webservices/TransactionService) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/5.5
There is nothing in the tomcat logs
If i try deploying on Jetty it all works fine.
Is there any explanation for this? Any pointers most welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Tomcat 可以以不同的方式侦听不同的主机名/IP。 具体来说,每个主机/IP 都可以有自己的工作目录:
部署到一个工作目录的应用程序将无法用于具有另一个工作目录的主机。
检查您的配置。
更新:如果名称指定为名称,而不是 IP,请检查该名称是否也解析为 10.* 地址。
此外,其中一台主机是默认的。 如果没有特定主机,它现在也会响应所有请求,无论它们的目标主机是什么。 对于您的设置,您可能只想仅保留该一项处于活动状态。
Tomcat can listen on different hostnames/IPs in a different way. Specifically, every host/IP can have its own work directory:
Application deployed to one workdir won't be available to a host with another workdir.
Check your configuration.
UPDATE: if name is specified as name, not IP, check that that name is resolved to 10.* address too.
Also, one of the hosts is default. It responds to all requests now matter what host they are targeted too, if there is no specific Host. For your setup you may want to leave only that one active.
我不认为更改 Tomcat 配置是答案。 我不必做这样的事情来使用我的本地 IP 地址或本地主机。
是否可以像添加到主机文件一样简单? 我的文件位于 c:/windows/system32/drivers/etc/hosts 中,其中有一个“127.0.0.1 localhost”条目。
I don't think a change to Tomcat configuration is the answer. I don't have to do such a thing to use my local IP address or localhost.
Could it be as simple as an addition to your hosts file? I've got mine in c:/windows/system32/drivers/etc/hosts, and there's an entry for "127.0.0.1 localhost" in it.