Tomcat webapp configuration on linux - linux

I have a webapp (springmvc 3.0.5/java 1.6 based) that I'm deploying to a tomcat (6.0.32) web server on a linux machine. Currently I copy the war file out to the server and let tomcat unpack it for me.
relevant lines in server.xml:
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
<Context docBase="fooapp" path="/" reloadable="true" source="org.eclipse.jst.jee.server:Fooapp"/>
</Host>
I want the webapp context path to be "/" so I don't have to add /fooapp/ to every url. http://www.mydomain.com/index.html instead of http://www.mydomain.com/fooapp/index.html
The issue is that in my current configuration the webapp is served from BOTH "/" and from "/fooapp" context paths because tomcat unpacks the war twice. Once to the fooapp directory and another time to the ROOT directory.
I'd like the web application to be unpacked just once to the fooapp directory and still served from the "/" context path. Can this be done on linux and if so how?
Note: This works on windows exactly as I want so I'm hopeful that linux can do the same thing.

The simplest method:
Delete your Context tag from the server.xml,
delete webapp/fooapp and webapp/ROOT directories,
copy your fooapp.war to the webapp directory as ROOT.war.
You can find some other methods in the Tomcat's documentation.

Related

Creating Virtual Directory on IIS for Coldfusion Lucee

I am trying to Move my Website on a local directory from Adobe Coldfusion to Lucee.
I was able to Install Lucee with the Windows Installer.
IIS is working fine.
When i Create a Virtual Directory from IIS to Map a Physical Path (C:/Website) outside the inetpub root folder (FOR IIS) or outside the Tomcat/webapps/ROOT folder (for Lucee), IIS doesn't load that physical folder. Instead it loads the inetpub root folder and i can't access files from the Physical Path Directory.
I am using //localhost/{The Alias} to call the Website but saying file not not found.
Obviously because it's calling from Inetpub file Directory, not the Physical path.
Are there any special configurations i need to make?
I have searched online and no post could help.
Note that i am using different computers.
Kindly Assist.
mod_cfml (the adapter that is used with Lucee/IIS along with the BonCode Connector) does not currently support virtual directories. You will need to configure those manually in the Tomcat context config, like so:
<Host name="lucee.org" appBase="/home/lucee/public_html">
<Context path="/vdir/" docBase="/home/other_user/public_html/some_other_directory/" />
<Alias>www.lucee.org</Alias>
</Host>

How to change Jenkins home directory (~/.jenkins) when there is no jenkins installed

I never installed Jenkins on my server. All I have done was downloading .war file and tomcat is hosting it. By default it made a directory under my home directory (~/.jenkins) which Jenkins using for its own config and parameters.
Is there anyway to change the directory that Jenkins is pointing to? I need to move this directory.
I searched for that a lot but people all gave a solution for the case that Jenkins is installed already.
The server is running 'Red Hat Enterprise Linux Server release 6.7', and Jenkins version is 1.642.4.
You can easily change the JENKINS_HOME location by adding an environment entry in the context container used by tomcat for the jenkins webapp (typically in /etc/tomcat[VERSION]/Catalina/localhost/[context-name].xml), like this:
<Context (..)>
(..)
<Environment name="JENKINS_HOME" value="[your jenkins home]" type="java.lang.String"/>
</Context>
In case of Apache Tomcat you can specify startup parameters, including JENKINS_HOME for specifying Jenkins directory, in $CATALINA_BASE/bin/setenv.sh file:
$ cat setenv.sh
CATALINA_PID="${CATALINA_BASE}/tomcat.pid"
CATALINA_OPTS="-Duser.language=en -Duser.country=US -Djava.awt.headless=true -DJENKINS_HOME=${JENKINS_HOME} -Xms1024m -Xmx8192m -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"
In above example ${JENKINS_HOME} is set an environment variable, but you can replace it by absolute path.
Please refer to Apache Tomcat documentation for more details.

Can't access remote tomcat webapps

I've got tomcat running on a remote Linux box. We have one web app running on it okay,
/project1 (not root), with a "project1.war" auto deployed. I've now uploaded "project2.war" and I can see it's been extracted etc., but when I go to mysite/project2 I get a "not found" error.
I can't for the life of me see any references in server.xml, context.xml, web.xml for project1 to map its URL, so I'm really at a loss for how I'm supposed to get /project2 seeable. I'm very new to Linux, looking for some advice. Here's my server.xml entry:
<Host name="mysite.co.nz" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
Have to add it to apache 2 sites-available list

New to IIS, looking for a way to handle logs and sessions upon a deploy

Deploying a ASP.Net application via Teamcity and a Nant scripts. Currently I am zipping up the directory from the local git repository (after building) and copying up to the test machine, Renaming the current web home directory and dropping in the new one. (with some scripts to get the web.config in place)
The question I have is how to handle the log and sessions directories. I want them in the current deployed directory but don't want to have to copy them from the old to new one. I was debated about having them stored in a different directory then the web home directory and just placing a shortcut pointing at that directory (would be in git so it would get deployed with everything else). In linux I have a link (ln) doing this very thing for me.
Is their a cleaner solution? Am I going about this the wrong way?
Instead of renaming the current web directory, copy it and then use NAnt's <delete /> task to delete the web directory excluding the log and session directories. Then simply unzip the new web application.
For example:
<delete>
<fileset basedir="${PublishLocation}">
<include name="**/*"/>
<exclude name="**/Logs/**/*" />
<exclude name="**/Sessions/**/*" />
</fileset>
</delete>

Tomcat Configure To Serve Static Files is not working

I have linux machine, on which I have deployed my project. I have some static content which I have placed at /var/grt_dynamic_images on physical harddisk on linux. I am using it as /EchlonSurvey/images/dynamic/images. It is working fine on windows but not on linux.
Here is the server.xml file snapshot, where I am doing this configuration.
<Context docBase="/var/grt_dynamic_images" path="/EchelonSurvey/images/dynamic_images" />
<Context docBase="/var/grt_dynamic_images/category_images" path="/EchelonSurvey/images/dynamic_images/cat_images" />
<Context docBase="/var/grt_dynamic_images/profile_images" path="/EchelonSurvey/images/dynamic_images/prof_images" />
In webpage, I get 404 error. The path is same but the image are not coming from docBase. I have checked, there are all image which I need.
http://.../EchelonSurvey/images/dynamic_images/cat_images/277152_9449%20sml.png
image not available
one suggestion. if you have a ROOT webapp, you can create a symbolic link within it and point to the folder you want to serve. so something like
/tomcat/webapps/ROOT: ln -s /var/grt_dynamic_images /EchelonSurvey/images/dynamic_images
when i do this, it 'works' but only if i am specifying an actual resource on the url, like a .png file. i still get 404's if i just stop the url at a folder level. i'm sure there's some Tomcat setting for displaying a folder listing but haven't looked into it.

Resources