Posts

Setup Samba server on Centos 6.2

After a long struggle I finally figured out how to setup a Samba server on Centos 6.2. Since Centos 6.2 doesn't have the Samba configuration GUI anymore I didn't know how to set it up. But after a lot of trial and error and my friend Google I manages to get it up and running without disabling SELinux :-). On a fresh installation of Centos 6.2 you need to follow the following steps: Install semanage  with yum yum -y install policycoreutils-python Configure the samba configuration file: /etc/samba/smb.conf [global] workgroup = yourworkgroupname server string = yourservername security = user passdb backend = tdbsam Configure your share in the same file [share] path = /your/share/path writable = yes guest ok = yes Set your samba password for your user by logging in with that user on the target machine and execute the following command: smbpasswd Open the Samba ports on your firewall [139/tcp,445/tcp,137/udp,138/udp] Now it's time for configuring SELinux. Enable the do

Tomcat behind Apache HTTP server using Spring Security

Since I have been struggling with applications not working properly behind Apache HTTP server that use Spring Security I dedicated this blog to this issue. When you develop an application using Spring security this works fine when just running on a Tomcat server e.g. http://localhost:8080/app-context/. The problems start when you want to setup your environment properly by adding an Apache HTTP server in front of it using proxy AJP. You would start by adding the following to your apache config file: ProxyPass /app-context/ ajp://localhost:8009/app-context/ This works fine when trying to go to http://servername/app-context/ but when you try to login you will be redirected back to the login page everytime. To avoid this behavior you need to add the following line to your Apache configuration: ProxyPass /app-context/j_spring_security_check ajp://localhost:8009/app-context/j_spring_security_check For some reason it doesn't work without this line which seems weird to me since you basical

Configure Tomcat as a deamon on Linux

Since I keep on forgetting how to do this I decided to put this on my blog to make it easier for me and other people that have the same issue as me. It's pretty simple actually but yesterday I caught myself forgetting how it needs to be done. Basically you need to follow to following steps to successfully. Step 1 - Creating startup deamon file You can take the following file and adjust it accordingly. You have to create this file in /etc/init.d/. #Jenkins startup script #!/bin/sh -e #Jenkins startup script #chkconfig: 2345 80 05 #description: Jenkins CI # Define some variables # Name of app APP=Jenkins # Name of the user to run as USER=tomcat # Location of application's bin directory BASE=/var/tomcat/instances/jenkins # Location of Java JDK export JAVA_HOME=/opt/java/jdk1.6.0_11 case "$1" in # Start command start) echo "Starting $APP" /bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/startup.sh &> /dev/null" ;; # Stop

Cargo-itest extended

I have been doing some work on the cargo-itest project and extended it with the following features: - JOnas support - Jetty support - Auto detection of configuration files for JBoss - Extended logging information to be able to detect problems in an easier way These changes will be in the next release 1.2.0. The auto detection is a nice one since it automatically picks up .properties files and -ds.xml (Data source files) from a preconfigured location so you don't have to copy them selves to the correct location. :-) In the future we will try to implement configuration by annotation since some users prefer doing configuration through annotation instead of an XML file. In this case a Spring context file.

Disk Defragmenter Could not start

Anyone getting the "Disk Defragmenter Could not start" message and on Windows XP this is what worked for me. Go to Control Panel, Select System and select the Advance Tab. Now Select Settings Under Performance and again select the advance tab. Under Virtual Memory select Change. Make sure that the Paging File Size for selected Drive for the Drive partition you want to Defrag has either a custom at least 2 times the amount of installed RAM if the space is available or is set to System Managed Size. Once I did this Defrag started working again. I don't know how the Page file got turned off on my system but this has been driving me mad for months!! Hope it helps someone else out there !!!

Shared configuration on Tomcat 6

In Tomcat 5 there was the famous ${catalina.home}/shared/classes which you could use for sharing class files, properties files etc. Tomcat 6 by default doesn't come with this directory. In a first glance it seems that you can't do it anymore :-(.. But that's not true :-).. You need to configure Tomcat to point to a directory which you want to be shared location so applications can pick up resources from the classpath. The configuration is very simple. Just go to ${catalina.home}/conf and open catalina.properties. Add the path to the  shared.loader property. It will look something like this: # # List of comma-separated paths defining the contents of the "shared"  # classloader. Prefixes should be used to define what is the repository type. # Path may be relative to the CATALINA_BASE path or absolute. If left as blank, # the "common" loader will be used as Catalina's "shared" loader. # Examples: #     "foo": Add this folder as a cla

Fastest XML parser

In most applications you need to do some XML parsing to either provide XML to external systems or parse XML from external systems or of course both. Since the systems I work on use a lot of XML and they need to be as fast as possible I did some tests on several XML parsers. I tested the following parsers/XML frameworks: JDom Piccolo StaxMate XStream JAXB 2.1 All parsers were tested in isolation with the following parameters: 25 threads running simultaniously Every thread calls the parser 100 times The results are as follows. JDom Avg. parsing time: 325.24 ms Avg. memory usage: 307 KB Piccolo Avg. parsing time: 88.08 ms Avg. memory usage: 454 KB StaxMate Avg. parsing time: 96.16 ms Avg. memory usage: 203 KB XStream Avg. parsing time: 77.04 ms Avg. memory usage: 319 KB Jaxb 2.1 Avg. parsing time: 1778.12 ms Avg. memory usage: 618 KB As you can see XStream is the fastest one of them all. The total ranking of the parsers you can find below: XStream Piccolo StaxMate JDom JAXB 2.1