应用成功地部署在Tomcat中,但404错误 [英] Application succesfully deployed on Tomcat, but 404 error

查看:237
本文介绍了应用成功地部署在Tomcat中,但404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署了,有些斗争,(远程)的Tomcat 5.5服务器上的Web应用(交钥匙的Linux附带了)。这是一个GoogleWebToolkit web应用程序与Java后端。

观察日志一切正常。该/管理应用程式,也显示在我的新的应用程序运行=真正的'。

但问题是,去/ URL对myApp 404提供了什么我到目前为止做的那样,没有成功:


  • 确定它不会在本地使用Eclipse中运行,做工精细有

  • 经过部署服务器上的日志,它成功地加载弹簧,以及其他一些库。事实上,它显示了相同的消息,当我在托管模式在Eclipse中运行它

  • 的/经理/主机经理/管理应用程序运行正常。

  • 重新加载应用程序开启/经理也说'OK'

  • 我有指定的欢迎文件,一个其实是存在的,直接打的也给404

  • 我使用('localhost'的)默认主机,就像/经理/主机管理器和/管理应用

  • 有没有在互联网上搜索,无济于事了不少。

  • 尝试了不同的Tomcat(V6)服务器(我家的Ubuntu中,一个我想要部署上是VPS某处净),并有它只是工作...重新安装VPS?

这是如何解决这一问题,找出问题是什么,或者什么可能导致此任何提示吗?
能有冲突?还有另一种应用在$ CATALINA_HOME / webapps中DIR运行,可以与对myApp冲突,这是在同一个目录中部署的?

下面是我的server.xml

 <?XML版本=1.0编码=UTF-8&GT?;
<服务器与GT;
  <监听器的className =org.apache.catalina.core.AprLifecycleListener/>
  <监听器的className =org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/>
  <监听器的className =org.apache.catalina.storeconfig.StoreConfigLifecycleListener/>
  <监听器的className =org.apache.catalina.mbeans.ServerLifecycleListener/>
  < GlobalNamingResources>
   <环境
    NAME =simpleValue
    键入=java.lang.Integer中的
    值=30/>
   <资源
     AUTH =容器
     说明=用户的数据库,可以更新并保存
     NAME =UserDatabase
     类型=org.apache.catalina.UserDatabase
     路径=的conf / tomcat的-users.xml中
     工厂=org.apache.catalina.users.MemoryUserDatabaseFactory/>
  < / GlobalNamingResources>
  <服务
  NAME =卡特琳娜>
   <连接器
    端口=8009
    redirectPort =8443
    地址=127.0.0.1
    协议=AJP / 1.3>
   < /连接器及GT;
   <发动机
    defaultHost =本地主机
    NAME =卡特琳娜>
     <境界的className =org.apache.catalina.realm.UserDatabaseRealm/>
     <主机
      的appBase =的webapps
      NAME =localhost的>
     < /主机>
   < /发动机>
 < /服务>
< /服务器>


解决方案

所以,你有一个Apache实例坐在Tomcat的前面。部分/全部到Apache请求转发到Tomcat的AJP 8009端口假设这Apache的Tomcat的桥工作确定,因此只专注于您的部署的应用程序,你可能需要增加一些 JKMount 指令到Apache的的httpd.conf 文件,以确保请求 /对myApp URL确实转发到Tomcat 。否则,他们是由Apache的,这意味着你得到一个404错误时,都没有发现这些资源提供服务。

I've deployed, after some struggle, a web-app on a (remote) Tomcat 5.5 server (Turnkey Linux comes with that). It is a GoogleWebToolkit web-app with a Java backend.

Observing the logs everything went fine. The /manager app also shows 'running=true' on my new app.

But the problem is, going to the /myApp url gives 404. What I've done so far, to no success:

  • Made sure it does run locally using Eclipse, works fine there
  • Checked the logs on the deployment server, it succesfully loads Spring, and some other libraries. In fact, it shows the same messages as when I run it in hosted-mode in Eclipse
  • The /manager, /host-manager, /admin applications run fine.
  • Reloading the app on /manager also says 'OK'
  • I have a welcome file specified, one that is actually there, directly hitting that also gives 404
  • I use the default host ('localhost'), just like the /manager, /host-manager and /admin apps
  • Did a lot of searching on the internet, to no avail.
  • Tried a different Tomcat (v6) server (my home ubuntu box, the one I want to deploy on is a VPS somewhere on the net), and there it just works... Reinstall the VPS?

Any hints on how to fix this, find out what the problem is, or what might cause this? Can there be conflicts? there is another app running in the $CATALINA_HOME/webapps dir, can that conflict with myApp, which is in the same directory deployed?

Below is my server.xml

<?xml version="1.0" encoding="UTF-8"?>
<Server>
  <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <GlobalNamingResources>
   <Environment
    name="simpleValue"
    type="java.lang.Integer"
    value="30"/>
   <Resource
     auth="Container"
     description="User database that can be updated and saved"
     name="UserDatabase"
     type="org.apache.catalina.UserDatabase"
     pathname="conf/tomcat-users.xml"
     factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
  </GlobalNamingResources>
  <Service
  name="Catalina">
   <Connector
    port="8009"
    redirectPort="8443"
    address="127.0.0.1"
    protocol="AJP/1.3">
   </Connector>
   <Engine
    defaultHost="localhost"
    name="Catalina">
     <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
     <Host
      appBase="webapps"
      name="localhost">
     </Host>
   </Engine>
 </Service>
</Server>

解决方案

So you have an Apache instance sitting in front of Tomcat. Some/all requests to Apache are forwarded to Tomcat AJP port 8009. Assuming this Apache-Tomcat bridge is working ok, and thus focusing only on your deployed application, you probably need to add some JKMount directives into Apache's httpd.conf file, to ensure that requests to /myApp url are indeed forwarded to Tomcat. Otherwise, they are served by Apache, which means that you get a 404 error when those resources are not found.

这篇关于应用成功地部署在Tomcat中,但404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆