I have deployed web application on tomcat7 and now I am looking forward to update Virtual host to map domain name with my application by updating server.xml.
Is my approach correct?
I am working on ubuntu OS and not sure how to get the context path for my web app. Any help is greatly appreciated.
The context path of your application will be the name of the war file. If you want to override it, you can follow Tomcat's documentation (https://tomcat.apache.org/tomcat-7.0-doc/config/context.html).
Edit the server.xml in the conf folder of the tomcat installation and make the following changes.
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="/yoururl" docBase="YourApp" useHttpOnly="false">
<Manager pathname="" />
</Context>
</Host>
Related
I'm doing some deploy / start / stop tests locally on my computer, and it would be very comfortable to have my webapps deployed (so they can be managed throught the Tomcat manager webapp) but not started right away when Tomcat start.
Is this feasible at all?
Within the documentation I only found how to deploy or not deploy a webapp at all (through the "Host" configuration in server.xml).
This is a portion of my server.xml:
<Host name="host1.localpc" appBase="C:\tools\tomcat\webapps\host1" unpackWARs="true" autoDeploy="true" deployIgnore="^(?!ROOT$).*?$" deployOnStartup="true">
<Context docBase="C:\tools\tomcat\runnable\apache-tomcat-7.0.69\webapps\manager" path="/manager" privileged="true" />
</Host>
<Host name="host2.localpc" appBase="C:\tools\tomcat\webapps\host2" unpackWARs="true" autoDeploy="true" deployIgnore="^(?!ROOT$).*?$" deployOnStartup="true">
<Context docBase="C:\tools\tomcat\runnable\apache-tomcat-7.0.69\webapps\manager" path="/manager" privileged="true" />
</Host>
<Host name="host3.localpc" appBase="C:\tools\tomcat\webapps\host3" unpackWARs="true" autoDeploy="true" deployIgnore="^(?!ROOT$).*?$" deployOnStartup="true">
<Context docBase="C:\tools\tomcat\runnable\apache-tomcat-7.0.69\webapps\manager" path="/manager" privileged="true" />
</Host>
Hostnames are handled throught the Windows HOSTS file.
I'm running Tomcat 7.0.69
Hum... Certainly, as far as I know, any war is automatically started by Tomcat just after being deployed. Still, I'd suggest you to take a look at the Tomcat Client Deployer, a module from which you can get an Ant script to deploy-and-stop your application. To accomplish this, you should:
Download the TCD.
Parametrize the build.xml.
Invoke ant deploy stop to deploy and stop.
I cannot find any declaration in server.xml for the "examples" webapp that is installed by default in Tomcat.
So where is the xml fragment in which this declaration had been done if not in server.xml ?
"Examples" is just one of various web applications deployed under Tomcat that loads web applications from folder "webapps" located under $CATALINA_BASE. This location is configured in server.xml, in tag "Host":
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
and can be changed if it is needed.
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
I deployed wars using tomcat manger. i am able to access all the deployed apps also..but my question is why i am not able to see the deployed wars in web apps folder.
I'm using Jenkins for war deployment to my remote server which uses Tomcat 7.
I need my application to be directly installed at dedicated port like this:
http://localhost:8083
instead of usual:
http://localhost:8080/myCoolApp
To achieve this I deploy my war archive as ROOT directly to 'webapp' Tomcat's directory.
Everything works fine, archive is sent and deployed but I get an error from Jenkins:
Just to remind - archive is deployed successfully!
But as a perfectionist I just can't stand a result like this.
Here is my configuration for Jenkins deployment:
Here is Tomcat configuration for my application as a separate service:
<Service name="Jangel">
<Connector port="8083" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" />
<Engine name="Jangel" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
<Host name="localhost" appBase="Jangel" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
So the question is - how should I configure correctly Tomcat&Jenkins?
Or how may I avoid/silence this Jenkins error?
Try this by replacing the context path in your jenkins deployment by / (slash) instead of writing ROOT.
I want to deploy my app to the server, and then I can visit the app like this:
http://10.10.10.10/index.jsp
but not
http://10.10.10.10/bar/index.jsp
so this is my host configuration in server.xml:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context docBase="/home/foo/bar.war" reloadable="false" path=""/>
</Host>
But, after I start up tomcat
sh $CATALINA_HOME/bin/startup.sh
I found that tomcat does not unpack the war file in $CATALINA_HOME/webapps.
then I try to delete all files in $CATALINA_HOME/webapps/ROOT, but it does not matter.
so is there someone come cross this issue before? and how to solve the probelm?
Tomcat 7 does not unpack WAR files from outside the Host's appBase into the appBase.
Tomcat 7 will run your application from the WAR.