Tomcat :: WAR vs JARs

33 views
Skip to first unread message

AJ Mercer

unread,
Jun 27, 2009, 8:03:29 PM6/27/09
to ra...@googlegroups.com
I have been looking through blog posts on installing Railo on Tomcat and there seems to be two approaches
- Railo WAR in Tomcat webapps
- Railo JAR files in Tomcat/lib

I was wondering if someone could explain the pros and cons of each method?

--
AJ Mercer
Web Log: http://webonix.net

Jordan Michaels

unread,
Jun 27, 2009, 9:04:02 PM6/27/09
to ra...@googlegroups.com, ra...@googlegroups.com
Using the WAR file in the webapps directory only effects the one webapp. So... only that one webapp will have CFML processing capability. Placing the JARs in the lib directory is more "global" meaning all your CFML apps will have CFML processing capability.

Hope this helps!

Warm regards,
Jordan Michaels
Vivio Technologies

Michael Offner-Streit

unread,
Jun 28, 2009, 1:40:03 AM6/28/09
to ra...@googlegroups.com
Hi AJ

Please consult the following doc for details
http://classic.railo.ch/en/index.cfm?treeID=212

a WAR (Web ARchive) is a zip File and in this zip file you can find the
railo jars as well (at /WEB-INF/lib)

greetings micha


AJ Mercer schrieb:
--
Michael Offner-Streit
CTO
Railo Technologies GmbH
michael...@railo.ch
www.getrailo.com

Mailing List (english): http://groups.yahoo.com/group/railo_talk/
Mailing List (german): http://de.groups.yahoo.com/group/railo/
Linked in: http://www.linkedin.com/e/gis/71368/0CF7D323BBC1
Issue Tracker: http://jira.jboss.org/jira/browse/RAILO
Blog: http://www.railo-technologies.com/blog


whostheJBoss

unread,
Jun 28, 2009, 4:47:34 PM6/28/09
to Railo
Micha, is this information outdated?

It states that the community edition can only be used with one web. If
I have Railo installed globally on Tomcat or JBoss and I have separate
contexts for each, do they all share data sources and admin? I'm
pretty sure this is not the case.

On Jun 27, 10:40 pm, Michael Offner-Streit <michael.off...@railo.ch>
wrote:
> Hi AJ
>
> Please consult the following doc for detailshttp://classic.railo.ch/en/index.cfm?treeID=212
>
> a WAR (Web ARchive) is a zip File and in this zip file you can find the
> railo jars as well (at /WEB-INF/lib)
>
> greetings micha
>
> AJ Mercer schrieb:
>
> > I have been looking through blog posts on installing Railo on Tomcat
> > and there seems to be two approaches
> > - Railo WAR in Tomcat webapps
> > - Railo JAR files in Tomcat/lib
>
> > I was wondering if someone could explain the pros and cons of each method?
>
> > --
> > AJ Mercer
> > Web Log:http://webonix.net
>
> --
> Michael Offner-Streit
> CTO
> Railo Technologies GmbH
> michael.off...@railo.chwww.getrailo.com

Todd

unread,
Jun 28, 2009, 5:27:21 PM6/28/09
to ra...@googlegroups.com
Only in Railo 3.1+ -- still people using 3.0.x

On Jun 28, 2009, at 4:47 PM, whostheJBoss <dotf...@changethings.org>
wrote:

whostheJBoss

unread,
Jun 28, 2009, 7:05:24 PM6/28/09
to Railo
True, although he seems to be looking into installation. I wouldn't
think there would be any advantage to choosing 3.0 vs. 3.1 right now.

On Jun 28, 2:27 pm, Todd <web...@gmail.com> wrote:
> Only in Railo 3.1+ -- still people using 3.0.x
>
> On Jun 28, 2009, at 4:47 PM, whostheJBoss <dotfus...@changethings.org>  

AJ Mercer

unread,
Jun 28, 2009, 7:21:48 PM6/28/09
to ra...@googlegroups.com
cool - thx
I will go with JARs in /lib then


2009/6/28 Jordan Michaels <jor...@viviotech.net>

Dave

unread,
Jun 29, 2009, 2:33:33 AM6/29/09
to ra...@googlegroups.com
I started out with the jar install and ended up going to war file.
I liked the jar way at first because it auto-generated all the web-inf folders for you as soon as you made a site in tomcat but if you screwed up the path it would spawn those files all over the place and 1 sub-level deep which could mean you could have hundreds of them running and a pita to find and delete them all.

So I ended up going with war files and it's been a bit better.

whostheJBoss

unread,
Jun 29, 2009, 2:39:01 AM6/29/09
to Railo
Hey, I'm ending up with WEB-INF all over, in any first-level sub
folder. I have my appBase="sites/site1" site2,site3, etc and they have
no defined context or docRoot. They each only have a ROOT folder
(which works fine, the sites come up with the proper files, etc) but
the WEB-INF is being generated everywhere 1 level deep. Can you tell
me what is causing this and how to stop it?

I was trying WAR deployment, but I kept getting a white page when I
tried to use them.

Dave

unread,
Jun 29, 2009, 2:56:29 AM6/29/09
to ra...@googlegroups.com
yeah .. thats a bitch...
I'm still finding them and hell I am even on a new puter now.

the cause is your tomcat file is wrong, it should be like this:(on os x)

<Host name="www.site.com" appBase="webapps">
<Context path="" docBase="/Volumes/Sites/site/" />
<Alias>site.com</Alias>
</Host>


appbase SHOULD be webapps
context path should be empty


on the wars...
how did you do it? did you copy and paste the web-inf folder from
webapps into each site or are you trying to drop war file into each app?

whostheJBoss

unread,
Jun 29, 2009, 3:29:09 AM6/29/09
to Railo
Well, I've created a separate virtual host for each site, so I had
created a sites folder with sites/site1, sites/site2, etc and each has
a ROOT, so sites/site1/ROOT, etc with the appBase="sites/site1" etc

The sites show up fine and work, so Tomcat has no problem finding them
this way and finding the WEB-INF. I've read lots of places to not
define the context path or docBase in the server.xml, but instead to
leave it up to Tomcat if you have the virtual host set up with a ROOT
application.

For WAR I've seen that you are supposed to put a META-INF that
contains a context.xml (which you can also do with just an expanded
directory, not just WAR).

So my host looks like this:

<Host name="foo.com" appBase="sites/foo" autoDeploy="true"
unpackWARs="true">
<Alias>www.foo.com</Alias>
</Host>

Then in sites/foo is:

index.cfm
WEB-INF/web.xml
META-INF/context.xml

In the context.xml is:

<Context antiResourceLocking="false" privileged="true" />

Like I said, it finds it all fine and runs out of the root, but I end
up with those WEB-INF.

I haven't needed to specify a docRoot

Dave

unread,
Jun 29, 2009, 3:50:02 AM6/29/09
to ra...@googlegroups.com
The thing with your way is that.. well it doesn't work right, you are
over complicating it.
I read lots of things to and really none of them worked and the way I
have it now I have dozens of sites running in production so it must be
ok.

<Host name="www.site1.com" appBase="webapps">
<Context path="" docBase="/Volumes/Sites/site1/" />
</Host>

lets go over this:

name: well that is self explanatory
appBase: that is the base for the main railo server which is in
webapps, if you change this it will still work in some cases but like
you are seeing with yours it's not right. In other words appBase =
main railo engine which should be in webapps
contxt path: if you put stuff here with jar install it will spawn all
those web-inf folders everywhere
docBase: use this to put your apps outside the web root, most of what
you read says not to but don't waorry about what you are reading most
of those weren't written for deploying cfm sites. And the root
application usually means tomcat is serving 1 app not many.

running on tomcat with war is dead simple:
install tomcat
open up webapps folder in tomcat and drop railo war into it
start tomcat
rename the ROOT folder to something else or delete it
rename exploded railo war folder to ROOT
copy the web-inf folder to each sites root
make the tomcat server file just like i showed you... forget what you
have read and do it like I showed u
if running through apache add vhost file, here is my base one

<VirtualHost *:80>
ServerAdmin da...@dffss.com
DocumentRoot "/Volumes/Sites/site1"
ServerName www.site1.com
ServerAlias site1.com
ServerAlias ftp. site1.com
DirectoryIndex index.cfm index.html

<Directory "/Volumes/Sites/site1">
Allow from all
</Directory>

ProxyPreserveHost On
ProxyPassReverse / ajp://localhost:8009/

RewriteEngine On
RewriteRule ^/(.*\.cf[cm])$ ajp://localhost:8009/$1 [P]
RewriteLog /private/var/log/apache2/site1/site1.com-rewrite_log
RewriteCond %{HTTP_HOST} !^www\. site1\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www. site1.com/$1 [L,R]

ErrorLog "/var/log/apache2/site1/site1.com-error_log"
CustomLog "/var/log/apache2/site1/site1.com-access_log" common
</VirtualHost>



If you stick with your way you will have issues, I can tell you that
right now

whostheJBoss

unread,
Jun 29, 2009, 4:07:40 AM6/29/09
to Railo
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

Any thoughts?
>      ServerAdmin d...@dffss.com
>      DocumentRoot "/Volumes/Sites/site1"
>      ServerNamewww.site1.com
>      ServerAlias site1.com
>         ServerAlias ftp. site1.com
>      DirectoryIndex index.cfm index.html
>
>      <Directory "/Volumes/Sites/site1">
>      Allow from all
>         </Directory>
>
>      ProxyPreserveHost On
>         ProxyPassReverse / ajp://localhost:8009/
>
>         RewriteEngine On
>         RewriteRule ^/(.*\.cf[cm])$ ajp://localhost:8009/$1 [P]
>         RewriteLog /private/var/log/apache2/site1/site1.com-rewrite_log
>         RewriteCond %{HTTP_HOST} !^www\. site1\.com [NC]
>         RewriteCond %{HTTP_HOST} !^$
>         RewriteRule ^/(.*)http://www. site1.com/$1 [L,R]

Dave

unread,
Jun 29, 2009, 4:15:01 AM6/29/09
to ra...@googlegroups.com
well you can search and read all you want but remember as you are searching and reading and wasting time that my server is up and humming along perfectly.
I spent months reading all that stuff to and I ended up where I ended up which was a combo of what I was doing and sean corfields way.

that page you sent
"At the simplest, edit the Engine portion of your server.xml file to look like this:"

yes but you need to understand the are talking about things a bit different then how you need to run them with railo.

whostheJBoss

unread,
Jun 29, 2009, 4:19:28 AM6/29/09
to Railo
Learning isn't a waste of time, I just like to make sure that the
advice I'm getting isn't the only way or that it might not address one
of my concerns. I know to know all of the ways it can and should be
done. I'm not even running Tomcat stand-alone for production, I'm
running JBoss, which I have configured wonderfully. Questioning you is
the same as questioning the Tomcat site... I just like to be sure.

I've been knee-deep in the JBoss configurations here and I know what's
going on, I understand the deployment.

"yes but you need to understand the are talking about things a bit "

Exactly, that's why I'm posting and asking questions and reading...

whostheJBoss

unread,
Jun 29, 2009, 4:26:39 AM6/29/09
to Railo
Ok, so I changed my settings:

Now I have this:

host:

<Host name="foo.com" appBase="webapps" autoDeploy="true"
unpackWARs="true">
<Context path="" docBase="/web/sites/foo/" />
<Alias>www.foo.com</Alias>
</Host>

in /tomcat/webapps I just have ROOT, so /tomcat/webapps/ROOT which has
index.cfm, WEB-INF, so this where the Railo server lives.

In /web/sites/foo:

index.cfm
images
scripts
WEB-INF
WEB-INF/web.xml

I start up and can see the site fine, however, there is a WEB-INF
inside of images and scripts, so I'm seeing the exact same behavior as
with the way I had it set up before your changes.

It is still generating WEB-INF in all of the sub-folders, even
configured your way.

On Jun 29, 1:15 am, Dave <cfl...@jamwerx.com> wrote:

whostheJBoss

unread,
Jun 29, 2009, 4:33:10 AM6/29/09
to Railo
I had used Sean's guide originally, but received a firestorm of
criticism on the Tomcat forums for supporting using a docBase and not
isolating the appBases, so I wanted to see what others have come up
with.

No solutions are stopping my rampant WEB-INF generation though, even
followed exactly.

Dave

unread,
Jun 29, 2009, 4:35:50 AM6/29/09
to ra...@googlegroups.com
I understand what you are saying.. I had just done it all myself and
unfortunately most of the readings available on it just made things
more confusing, one things says this and the next page says something
different..

Dave

unread,
Jun 29, 2009, 4:38:05 AM6/29/09
to ra...@googlegroups.com
thats because you still have the jar files in there... i would assume
take the jar files out and use war and it will be fine

whostheJBoss

unread,
Jun 29, 2009, 4:43:22 AM6/29/09
to Railo
JAR files are only located in /tomcat/railo ...

Dave

unread,
Jun 29, 2009, 4:43:40 AM6/29/09
to ra...@googlegroups.com
I dunno why they would say that unless they didnt understand what you
were doing
usually docbase points to the war file per app but since really you
are only using railo to process the cfm files and not the whole app
(like a jsp app) then you point it to the webapps since that is where
the "magic happens"

You really don't need all that unpacking code in there unless you are
dropping war files in the actual sites.

I would get it to work like the rest of us did and then go back and
figure out why it works.. unless you got lots of time to check it all
out.

whostheJBoss

unread,
Jun 29, 2009, 4:53:53 AM6/29/09
to Railo
Well, I have it configured exactly per Sean's guide and it works, it
just generates those WEB-INF

As far as docRoot, I was advised by the Tomcat crowd to define the
appBase="sites/site1"

And then in sites/site1 have:

sites/site1/ROOT.war

and inside ROOT.war:

index.cfm
WEB-INF/web.xml
META-INF/context.xml

etc

To then leave the context path and docRoot blank and let the WAR be
deployed based on its location.

I'll stick with your way, just wish the WEB-INF issue would disappear,
I'll try from a fresh Tomcat install and let you know.
> ...
>
> read more »

whostheJBoss

unread,
Jun 29, 2009, 4:57:50 AM6/29/09
to Railo
Ok, it seems to be working great now. It must have been something
cached in Tomcat somewhere, perhaps conf/Catalina or /tomcat/work

Either way, it's not giving me WEB-INF anymore :)

On Jun 29, 1:43 am, Dave <cfl...@jamwerx.com> wrote:
> ...
>
> read more »

Jamie Krug

unread,
Jun 29, 2009, 11:33:53 AM6/29/09
to Railo
AJ,

Placing the Railo jars in a main Tomcat or JBoss lib folder can
generate more folders/files than you'd like (or at least in more
locations than you'd like), but if you have a Tomcat instance that is
meant only for Railo apps, then it's a great way to go.

This blog post of mine might help clarify a few options:
http://bit.ly/5bSwY

This blog post by Sean Corfield is a more complete overview as well:
http://corfield.org/entry/Railo_on_Tomcat__multiweb

The WAR deployment will give you a copy of the Railo jars for every
Web application, rather than sharing a "global" instance library. So,
if you have a lot of Web apps running on the same Tomcat instance and
you don't have a real need for full-blown WAR deployment, then this
may be a waste. On the other hand, if you have just a few apps and
you'd like to leverage WAR deployment and keep each app neat and tidy
and easy to deploy, then by all means!

Hope this helps!

Best,
Jamie

Dave

unread,
Jun 29, 2009, 1:24:00 PM6/29/09
to ra...@googlegroups.com
When yu use seans tuts it shouldn't generate additional folders, well
at least I only say that with the jar file install.

The tomcat guys are saying how they do their java apps which is
different than the railo one.

That's the problem with the docs because there isn't anything to help
give info on this.
Reply all
Reply to author
Forward
0 new messages