Tomcat6 - how to put a project into the root folder?
Delete ROOT
folder, rename MyProject.war
to ROOT.war
and restart.
You can also do it by adding the following line to inside the <Host>
entry of /conf/server.xml
<Context docBase="MyProject" path="" />
Change the root context to other folder in tomcat 6
This is a way to do it (step-by-step):
Put your expanded WAR in a directory outside of webapps. My TOMCAT_HOME is
/home/nikos/apache-tomcat-6.0.37
and I placed my app in the foldermyapp
under a new folder:$TOMCAT_HOME/webapps-manual
. I.e. the folder structure is:$TOMCAT_HOME
|
+- ...
|
+- webapps (NOT HERE!!!)
|
+- webapps-manual
|
+- myapp
|
+- index.jsp
|
+- WEB-INF
|
+- web.xml (optional)Edit TOMCAT_ROOT/conf/server.xml. Add the following
<Context>
under the appropriate<Host>
element (there is probably only one):<Host ...>
<Context
path="/application/dashboard"
docBase="/home/nikos/apache-tomcat-6.0.37/webapps-manual/myapp"
/>
</Host>DONE! Open
http://localhost:8080/application/dashboard/index.jsp
and see content generated by$TOMCAT_HOME/webapps-manual/myapp/index.jsp
.
See relevant documentation here (see attributes path
and docBase
).
Tomcat - making a project folder the web root
The solution I use is to set this in your Tomcat server.xml
Add a <Context>
element within the <Host>
like below which sets your mysite
as the default web app. Note the empty path=""
which makes it the default.
<Context docBase="mysite" path="" />
Attributes of Context Container from the Tomcat docs:
docBase You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory
of the owning Host.path All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are
defining the default web application for this Host, which will process
all requests not assigned to other Contexts.
See others who have had similar question and the similar answer here, here and here
See also Apache Tomcat Configuration Reference - Context
Where to put jsp project folder in tomcat for hosting?
I think dailymotion-cloudkey-java-73f6f35, does not have WEB-INF folder with web.xml file. Due to which it is not able to locate the resources.
or
You can copy your dailymotion-cloudkey-java-73f6f35 project directory into ROOT folder and then try the same URL.
How does Tomcat locate the webapps directory?
It can be changed in the $CATALINA_BASE/conf/server.xml
in the <Host />
. See the Tomcat documentation, specifically the section in regards to the Host container:
Tomcat 6 Configuration
Tomcat 7 Configuration
The default is webapps
relative to the $CATALINA_BASE
. An absolute pathname can be used.
Hope that helps.
How to install Tomcat6 manager application
I fixed the problem by removing Tomcat 6 and installing Tomcat 7 according to this tutorial using following command line statement:
sudo yum install tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps
tomcat 6 not looking for classes in webapps folder at startup
If you are deploying the project as .war then you should not get the ClassNotFoundException but i suggest you to rework on your project set up.
If you are using the Eclipse IDE then just setup a new server in the IDE and then Run As>Run In Server....this may help i.e. redefining your server and redeploying too .
Related Topics
Accessing Files Outside the Document Root with Apache
Best Way to Make Linux Web Services
Compare Md5 Sums in Bash Script
Is There an Scp Variant of Mv Command
Does Linux Support Memory Isolation for Processes
How to Execute Multiple Commands After Sudo Command
How to Copy a File with '$' in Name in Linux
Bash (Or Other Shell): Wrap All Commands with Function/Script
Is It Good Practice to Use Mkdir as File-Based Locking on Linux
How to Configure a Specific Ip in Prometheus Yml Configuration File
How to Initialize the Attribute Group Correctly for a Platform Driver
Zipping Without Creating Parent Folder
How to Run Command During Docker Build Which Requires a Tty
Why Does This Movq Instruction Work on Linux and Not Osx