[Helma-user] Running under Tomcat

Maksim Lin for technical support mailling lists maksim_lin at ngv.vic.gov.au
Fri Aug 17 05:08:19 CEST 2007


> 
> Also, I had to move everything from the /welcome/code/ dir to 
> /welcome/

oops sorry! that was a copy-paste error on my part. 
Because welcome apps code is in "code" folder so the setting in web.xml
should be:
<param-name>appdir</param-name>
<param-value>/helma/helma-1.6.0/apps/welcome</param-value>
 
because in helma the "appdir" refers to the place the code fodlers for
an app are and *not* that actual top level folder of the app. ITs just a
convention for instance to put a "code" folder and a "static" folder
inside a top-level folder with the same name as an app.

> So, finally, I have it running. If it's running under /hop I 
> need to put
> 
> welcome.mountpoint = hop/
> 
> In the apps.properties right? This doesn't seem to be working 
> - it's linking to everything at / still?

Yep this was what I ran into yesterday with the static files like css
and image not being found.
The thing is though, the "standalone servlet" class does not actually
use the apps.properties file (it seems to be only used when helma runs
in 'embedded' mode using its own jetty container).
So digging a bit further...

There is a "baseUri" property for an apps app.properties file (the file
needs to be in the "appdir" folder you defined for the app in web.xml.
so for me adding to welcome's app.properties:
baseUri = /helma

fixed up all the urls being generated by the welcome app.

BUT be very careful regarding the url-pattern you use, as this is
*relative* to the "web application context path" .
Normally I guess you would just use "/*" as you want the helma servlet
to handle every request to your " helma web application" (webapp in the
servlet api sense).
So if your webapp is in the tomcat/webapps/helma folder its context path
is "/helma" and the "/*" applies to everything on the url req after
"/helma". See the servlet spec chap11 for all the gory details.

Now with serving static files its upto the servlet container to do this
and when running helma+jetty, helma is just doing this for you by
configing jetty based on the settings in apps.properties.

So with tomcat you need to have for instance a folder inside
tomcat/ROOT, eg.
tomcat/webapps/ROOT/helma-static

then if you say put a image in there:
tomcat/webapps/ROOT/helma-static/helmaheader.png

you would refer to it in your html as:
<img src="/helma_static/helmaheader.png" />

(to give due credit, I actually found this tip about ROOT in a posting
on the helma mailist:
http://helma.org/pipermail/helma-user/2004-March/005728.html

The threads on this topic from that month are quite handy and also
suggest you'll probably want to define a logDir property in your
app.properties as well. 
see here for complete list of helma properties and which file they go
in:
http://helma.org/docs/guide/properties/listall/

hopefully that should get you up and running.

Maks.


More information about the Helma-user mailing list