Posts Tagged ‘Java’

Easy XML parsing using JAXB annotations

Wednesday, June 24th, 2009

I had to do some simple xml parsing the other day so thought I would checkout JAXB annotations, I was amazed at how easy it was to parse simple xml documents, but, there was no easy how to document to get you going. I had to trawl through a lot of older documentation to find what I wanted. So anyway, this is how I did it…. (more…)

Using Stripes Action Beans as Welcome Pages

Monday, May 18th, 2009

So I wanted to use an action bean as my welcome page, I could have an index.html do a meta refresh to my Welcome.action but that’s a bit rubbish. So anyway, I had to map the StripesDispatcher directly to a url and include that url in my welcome file list, here is a snippet from my web.xml

<servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>/Index.action</url-pattern>
</servlet-mapping>
<welcome-file-list>
         <welcome-file>Index.action</welcome-file>
 </welcome-file-list>

Hope that’s useful to someone ! :)

Java Web Applications and Tomcat on low memory servers

Monday, May 4th, 2009

I was helping out a family member develop a easy to manage gallery and e-commerce site.  To keep costs down and as a bit of a challenge we opted to go for a server with only 128 meg of ram (only £9 a month with a 5 meg sync line). On this we would need to deploy a jvm, tomcat, mysql database, mail server and the usual list of system applications (ssh and so on). If you add on the requirements for some chunky JAI image resizing code things were going to be tight.

The normal setup (debian) would be apache 2 serving on port 80 connected (mod_jk) to tomcat running on the Sun JVM. We would have open ssh  for remote access, mysql as the database and postfix as the mail server.  This doesnt work out of the box, the server was using swap space straight away. Java doesnt work out of swap space.

The first thing to go was the apache webserver, I just told tomcat to listen on port 80. Next we needed to tune the out of the box settings for mysql server, these two lines will save you a reasonable about of ram:

skip-bdb
skip-innodb

(more…)

In the begining…

Tuesday, April 28th, 2009

I have been a java developer for a number of years now for a well know online second hand car website. I operate on a Linux (Debian) based machine and develop and host applications on Linux based servers. I use (and am a fan of) open source software and continually turn to the web for support and assistance. So I thought it was about time I gave something back, I don’t recon any of my home projects are wanted by other people… and to be honest… there are much better alternatives out there but where is the fun in that? Hacking something together is half the fun! So the only other thing I could contribute would be my experiences of installing, maintaining and developing on the systems I use. That’s why I have started this blog in the hope that someone else might learn from my experiences to make their life that little bit easier. So over the comming weeks and months I hope to write some small articles on issues I have had and solved in the last couple of years.

Happy reading :)