Laughing at the stony face of gloom

(your instinct can’t be wrong)

Posts Tagged ‘java

Server talking, talking server talk… reprise… (2)

leave a comment »

Okay – we’ve had a bit of a glitch today; but better late than never… onto meddling with the server. Currently we have tomcat 5 and nothing else running and we seem to have a healthy CPU situation. However, this is a physical box… so what is going to happen when we throw IIS or Apache into the situation? Well, let’s start with apache as I’ve just downloaded that and am raring to do an apache install on a windows production box… I know, I know – not so long ago this would have been frowned upon – but today… well… let’s give it a whirl and see what happens eh?


(installing apache 2.2.8 – using the msi windows installer with openssl)

so – first an install; Like tomcat I’m installing it into the C:\Apache\ folder ; I’m including all the headers and things (to allow other modules to link in – it might be handy – if not – I can always delete them later)

Making it available to all users on port 80 (or just the current user on 8080 – which seems to be already taken – meaning that the tomcat installation has to been shifted onto a different port; in this case 9090 (it doesn’t matter too much about this; ) – moments later – we have an install in place. Brilliant.

Now how to link the apache installation to tomcat ?

There are two methods we currently employ – one being through the mod_jk connectors (as per the IIS install) the other being through apache acting as a proxy. The former is always the preferred; but we’ll see what happens now.

A quick installation check; what do we have?
Okay – in the /modules subdirectory we have 67 modules… do we need all these modules? We might do? Who knows? Well – I would say – as this is going to be a “front facing server install” we’ll see what we need (so that’s the common ones – mod proxy, mod rewrite, mod openss yadda yadda yadda; and a few odds and sods – whatever apache considers “it’s essential core” :) – I’ll have to check… by default, apache’s httpd.conf has the following included

LoadModule actions_module modules/
LoadModule alias_module modules/
LoadModule asis_module modules/
LoadModule auth_basic_module modules/
LoadModule authn_default_module modules/
LoadModule authn_file_module modules/
LoadModule authz_default_module modules/
LoadModule authz_groupfile_module modules/
LoadModule authz_host_module modules/
LoadModule authz_user_module modules/
LoadModule autoindex_module modules/
LoadModule cgi_module modules/
LoadModule dir_module modules/
LoadModule env_module modules/
LoadModule include_module modules/
LoadModule isapi_module modules/
LoadModule log_config_module modules/
LoadModule mime_module modules/
LoadModule negotiation_module modules/
LoadModule setenvif_module modules/

(yeah, I know, I was saying all that in parenthesis; and I know I was being lazy – oh cut and paste – my typing fingers are in your debt!!))

One of the things I dislike about the “default” apache setup, is it’s use of conditionals – “if this, if that, if the other”… I do so prefer to explicitly state “load this module, use this rule” – but that’s me; each to their own :)

Reading through the “Using apache with windows” page there are a few oddities to be aware of, not least that meddling with the httpd.conf file when the service is running could lead to issues (as, due to way apache/windows works, it has a single parent process and a child process, which, on creation re-reads the httpd.conf (without needing a(n apache) server restart)!); Apache can, it seem, load isapi modules (yay! (or nay,yay)) but cannot load filters (“mod_isapi” notes)… hmm… I’d better check how it does the aj13 connector to tomcat… ah… no worries – from the notes on the “ftp/apache/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.26/” folder on your selected mirror : is for Apache 2.2, and works with Apache 2.2.4 and later.
Rename to before putting it in your
Apache2.2/modules directory.

phew. I was worried there :)

I’ll continue this thought tomorrow I think – it’s almost 5 already! Where does the time go (and why am I never invited :) ?)


Written by Mas

May 6, 2008 at 3:49 pm

Posted in web servers

Tagged with , ,

Server talking, talking server talk… reprise… (1)

leave a comment »

After getting our Tomcat5 / IIS6 installation up and running, we’ve noticed that we’re having a high CPU utilization; for 90% of the time the tomcat process is hitting %99 CPU usage. This is a bit of an issue as we aren’t planning “single server, single process”… So, we’re now doing some testing – to see

1) if we can replicate the issue

2) if we can make a solution
(proposed solutions so far – use Apache in front – don’t use any web server in front of Tomcat … )

The process:

1) download tomcat, java et al.
2) Install it :)

This time around (it’s hardly been a month) and the java version is now jdk1.6.0_06.

Java is installed to c:\java\jdk1.6.0_6 and C:\Java\jre1.6.0_06\
(no netbeans this time around – I don’t think they’re actually needed for what we want to do)

The Tomcat version is still apache-tomcat-5.5.26 (much slower turn-around?)

Tomcat is installed to C:\Apache\Tomcat_5.5

runtime is set to point to c:\java\jre1.6.0_06

Reading through tomcat notes (that I might have previously missed); Tomcat no-longer needs the full java jdk/sdk ( a mental note to be made, to myself, for future installations)

It looks like there are issues with JNI (Genie?) applications – I wonder if that could be causing some of the problems we’ve been having… -ponders-

Odd; we seem unable to access the server … I wonder if someone’s blocking 8080 on the firewall… ponders… oh well, it’ll wait until next week now

Written by Mas

May 2, 2008 at 3:56 pm

Posted in web servers

Tagged with , ,

Tomcat install (under linux) – part (2)

with 4 comments

Well, that was lunch… back to the install.

After all that work, we should have a working version of tomcat. However, we don’t have any users set up – so how do we manage our applications (etc) ? Well, first things first, let’s create a role in the

[tomcat root]/conf/tomcat-users.xml file.

it should look something like this

<?xml version=’1.0′ encoding=’utf-8′?>
<role rolename=”manager”/>
<user username=”[pick a name]” password=”[pick a password]” roles=”manager” />

once you have made the changes, you’ll need to restart tomcat
/[tomcat root]/bin/

(wait a few moments – you can type ps guax|grep java to see if the process has stopped before running)

/[tomcat root]/bin/

to start the service up again.

You can check in the /[tomcat root]/logs/catalina.out file to see if there are any errors generated .

Written by Mas

April 21, 2008 at 4:24 pm

Posted in web servers

Tagged with , ,

Tomcat Install (under linux) – part (1)

with 2 comments


Well, here we are again :) Installations! This time I’m installing Tomcat (not sure which version yet – possibly 6.x ) on a linux box. Of course, there’s a bit of head scratching and finding out exactly what we need to do prior to install.

So, we have a vanilla system. It has apache running but has never seen hide nor hair of anything like java. So first I have to download a jdk – sounds simple ? Well, it should be – but like many people I tend to get a bit confused when it comes to navigating Sun’s java site. So many varieties of jdk, sdk, jre with or without beans and whatever new “technological methods” Sun have come up with. Occasionally conflicting documentation (search for jdk linux – you get instructions telling you to install obsolete software … or is it obsolete ? I’ve no idea)

Installing Java

As I’m not sure I have access to compilers and the like (a legacy policy of never putting any sort of development malarkey on a front-facing server) I’m going to have to pick a binary install; which should work fine without any issues… I hope!

(fortunately, if there are any issues – this is a soon-to-be-decommissioned box that is just sitting around spinning it’s wheels, so to speak; so it’s not going to take down any “mission critical” applications … at least… it shouldn’t do :) )

In this instance, I’ve decided upon the Linux binary distribution of the Java SE Development Kit 6 (update 6) (I’d give a link to the page on but that looks to be generated via session variables on a by-user basis)


(from the page we are told to set the permissions on the file so we can execute it; they say chmod 755 jdk*.bin although my preferred method is chmod u+x jdk*.bin (but that’s just me … oh, and I’m just being lazy – you can type the whole jdk filename in if you want (or if you have lots of jdk’s in the folder and don’t want them all to be executable :) )))

let’s run the executable


Good grief ! That’s a long user agreement… I really should read it one of these days, I heard rumours of them smuggling clauses allowing them to take your first born son … but… life’s too short :) and generally they could be summarized into a simple statement

“you agree to not do anything naughty – like stealing things , we’ll find out and catch you you know.”

to which, we have to say “yes” (surely we should be able to say “no, we don’t agree” and still use the software? Are these things really binding? I don’t know… anyway… I’m digressing )
of course, once it gets to the end “Java(TM) SE Development Kit 6 successfully installed”

So what have I got ?

in the directory I ran the jdk in, there is now a folder “jdk1.6.0_06” ; to make upgrades (hopefully) easier, I’ll make a symbolic link to this directory

ln -s jdk1.6.0_06 java

I’ll now set up some environment variables (so we know where to find things)

emacs /etc/profile

(or feel free to use vi or whichever text editor you prefer)
Assuming you’ve not done anything to tweak the default profile, there will be a line in the file that says something like


before this line I’ll add the following

JAVA_HOME=/[path to java install eg. /usr/local/java]

and then on the end of this line I’ll add JAVA_HOME and CLASSPATH


that done, I can type . /etc/profile which’ll re-set the environment variables (which can be proven by typing java -version ); which in turn means we can now run java. Now to install tomcat. Let’s try tomcat 6…

Installing Tomcat 6

First to download our copy of tomcat. (Question: Why aren’t there any “linux” versions listed ? Answer: Because it’s java! The same package as is installed on windows will work on Macs, unix boxes and all sorts of places – probably even your hand-held device (assuming it has space for it!)

We’ll download the tar.gz version (tar being a unix standard “tape archive” (remember unix principles 101?) and gz being the gzip compression format (as tar archives are uncompressed by default – remember? Were you listening ? :) )) at the moment, the latest archive is (note that this is linking to one of the many mirror sites used for distribution of the apache/jakarta projects)

change directory to your installation folder – e.g. cd /usr/local
decompress the archive – gunzip apache-tomcat-6.0.16.tar.gz
untar the archive – tar -xmvf apache-tomcat-6.0.16.tar

(alternatively, you can miss out the decompressing stage and instead use tar -xmzvf (the z is for decompress gzip format)

we’ll make another symbolic link now, to make it (hopefully) easier to upgrade

ln -s apache-tomcat-6.0.16 tomcat

in the tomcat directory there will be a folder called “RUNNING.txt” – the following notes are derived from that…

First I’ll edit the /etc/profile file again and add in a new environment variable for “CATALINA_HOME” (this will point to the installation folder) and ensure that the variable gets exported – similar to the JAVA_HOME

in theory, we should now be able to start up tomcat and see it running on port 8080 – cd $CATALINA_HOME/bin and type ./

When I tried this just, it complained about being unable to find a file … “” – which is strange as it is right there… Let’s try and troubleshoot a little bit…

(A quick search online provides an answer to this – on the tomcat wiki )

We have to edit the and files and add the following lines (to the beginning)

BASEDIR=/[path to your tomcat install]
CATALINA_HOME=[/path to your tomcat install]

we can then try again – cd /path to tomcat/bin

if everything works okay, we should then be able to type

ps guax | grep java

which’ll show the process (note, versions of ps differ from system to system; so if you get an error, you can always try ps -guax or some other combination – remember the system manual is your friend :) man ps )

we can now try and display the site – in a web browser, point it to the server on port 8080 – if everything has worked (as it has in my case) you’ll get the default tomcat server page/documentation/examples.

And as everything has worked so far – I think it’s a good time to take lunch :)
More later!

Written by Mas

April 21, 2008 at 12:15 pm

Posted in web servers

Tagged with , ,