3

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 successfully 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>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Marten Sytema
  • 1,906
  • 3
  • 21
  • 29
  • Does the web.xml in your myApp have a welcome-file listed ? Can you try directly one of those like localhost:8080/myApp/index.html – JoseK Dec 08 '10 at 12:40
  • Yes, it has a welcome file, I also tried that, unfortunately it doesn't work :( – Marten Sytema Dec 08 '10 at 12:59
  • I just tried to deploy the app on a different tomcat (this time tomcat 6) , on a different server (my home linux box, the tomcat5.5 is a VPS). There it just works... Thus it has something to do with the server? Should I reinstall it? – Marten Sytema Dec 08 '10 at 13:51
  • by any chance, does the *server.xml* have a *path* attribute for the myApp which is set to a different url-pattern? – JoseK Dec 09 '10 at 05:20
  • @JoseK: no... the server.xml is pasted above btw! I just realized, it is Tomcat 5.5 on Apache, so I had to modify the mod_jk.conf to add my newApp (correct?). Well, modifying this and restarting tomcat did not work. Can this still be the problem, and are other steps to be done after modifying the mod_jk.conf? – Marten Sytema Dec 09 '10 at 12:54
  • Please post your web.xml file. – Nick Hristov Mar 13 '11 at 19:23
  • I guess you could have incorrect url-pattern in web.xml, so yea, posting web.xml would be good if you need help. – Rihards Mar 27 '11 at 01:00
  • Can you post everything relevant to this issue? I.e. mod-jk.conf, web.xml, etc... – benw Mar 29 '11 at 00:06

2 Answers2

2

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.

Tommi
  • 8,550
  • 5
  • 32
  • 51
2

The HTTPD/conf.d folder should have various .conf files which contains entries regarding the web applications configured. Either you can create a new .conf file or add the ProxyPass entry to an existing conf file. Adding a ProxyPass entry can route the request received to the tomcat. e.g. ProxyPass /myApp/ ajp://localhost:8009/myApp/. Tomcat should be listening on AJP Connector port 8009 for above example.

GDP
  • 8,109
  • 6
  • 45
  • 82
Manoj
  • 21
  • 1