3
votes

I had deployed one application on tomcat 6 on port 80. My application folder name was myApp1 and it is under webapps folder. I can access it with http://localhost/myApp1 I have under web application folder named as myApp2. Also I simply put the myApp2 folder under webapps folder.

But when I try to acces the application 2 with URL http://localhost/myApp2. I get error HTTP 404 saying requested resource myApp2 was nor found. Do i have to make some changes in configuration files also i.e. server.xml? Just for the formation both application are placed as folders not as war file

EDIT To give more info I can see only one entry for myApp1 inside server.xml

 <Host appBase="webapps" autoDeploy="true" deployOnStartup="true" deployXML="true"     name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
  <Context docBase="E:\workspace_4.3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT" path="" reloadable="false"/>  
<Context docBase="E:\workspace_fip_4.3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myApp2" path="/fipWebApp" reloadable="true" source="org.eclipse.jst.jee.server:myApp2"/> 
  </Host>
2
check if you are following the directory layout correctly. also recheck the xml configuration file.John
@M Sach: there's nothing special to do besides putting the .war under .../webapps/. By default on a stock Tomcat you'll already have several webapps under webapps, like a few examples and the manager webapp, etc. Just do the same for your app2: simply put your "myApp2.war" under webapps/.TacticalCoder
i tried creating war from command prompt jar -cvf myApp2.war but it gives error 'c' flag requires manifest or input files to be specified!M Sach
You've got E:\workspace_4.3 and E:\workspace_fip_4.3, is that correct?beny23

2 Answers

2
votes

That's the way to do it: You put a WAR file under the Tomcat /webapps file and refer to it in a context that's the same as the WAR file name.

Look at the Tomcat logs. You might have gotten a 404 because it didn't deploy properly.

You don't have to edit server.xml; you should never have to do that.

I'd recommend not creating a folder and dumping files into it. Better to package a proper WAR file and deploy that.

UPDATE: Read this carefully and follow each and every step to the letter:

http://docs.oracle.com/javaee/6/tutorial/doc/bnadx.html

1
votes

as far as i know there is no configuration. your myApp1 and myApp2 folders must be in the tomcats' workspace with valid index pages.