Where are the Java User Groups in Vietnam and in South-East Asia?

I’ve been wondering about this nearly three years ago already, looking for Java Communities in Ho Chi Minh City and Vietnam. Now I picked up an interest in this question again. While there has been tons of cool developments in other communities (Agile Vietnam, for example), there seems to be nothing new about good ol’ Java.

Especially looking at the Word Map of (registered) Java User Groups at http://www.java.net/jug-profile-map makes me wonder where all the JUG’s are in South-East Asia.

Even in more “mature” locations like Singapore, there doesn’t seem to be much around as I recently learned here.

Java, anyone? Watch out, I’m looking for you. And oh, if anybody is interesting in getting together and bringing Java forward in Vietnam, just drop a comment below or send me a message.

A brand-new Groovy / Grails user group Vietnam

In previous posts I’ve already been trying to explore software development communities in Vietnam. Since I am working with Grails in one of my current projects (very enjoyable!) I thought I’d start an experiment and found the “Groovy/Grails Usergroup Vietnam“.

After letting it sit for a couple of days I almost forgot about it until someone actually found the site, became a member and started a discussion! Admittedly, the discussion wasn’t about Groovy and Grails but rather why it’s so freakin empty on this page but still, it’s a member and a discussion.

So, Java people out there, let’s just continue with the experiment, invite more people and see where it goes. The actual community might really be very very small in Vietnam but maybe even more of a reason to get together here.

You’re not sure what Grails actually is? In very short I would describe it as “Ruby on Rails for Java” (is that ok to call it that?) and as a very entertaining and light-weight way of developing web applications based on Java. For more please check out the grails.org or the Wikipedia article or Google.

If you’re interested now, please join here: http://groups.google.com/group/groovy-grails-vietnam. And if you think the idea’s even more stupid than offering shoeshine for flip-flops, then join the comments below.

Java Communities in Ho Chi Minh City and Vietnam

Coming from one of the leading IT countries in the world, I was used to being surrounded by lots of resources about whatever I needed in order learn and to grow and develop in my profession, software engineering with focus on custom software development in Java. There are tens of thousands of books in my own language, more software development companies that I could ever apply for, conferences specialising in everything that was, is, or will soon be mainstream, and well, more communities that I could ever participate in and contribute to. Coming to Vietnam I found myself  in an environment that doesn’t offer most of what I just mentioned. On one hand that’s because there’s probably not as much going on as in my country yet and I’m thrilled to see what this dynamic country will have to offer tomorrow and the day after. On the other hand I guess there’s a lot hidden from me and waiting to be discovered.

So I started to look around and try to discover what’s going on out there. I wanted to stick to Java developers and Java communities first. It is what seemed to make the most sense to me although I had a feeling already that I shouldn’t be too picky. Here’s a brief summary of what I found so far:

  • First checks for Java User Groups (JUG) and Java meetups on meetup.com without success.
  • One website that’s really worth mentioning is javavietnam.org. Basically a forum for Java developers, it has an incredible number of registered users and quite some activity. Unfortunately for me, it’s mostly in Vietnamese. Incredible job though! I talked to one of the founders and heard that there also used to be real meetups in town and there are plans to revive them. Would love to see that and participate.
  • There’s also some activity in groups on LinkedIn, e.g. in Vietnam IT Community, in Vietnam Digital or in the IT subgroup of Linkin Vietnam. Not at all focused on Java or even software development but developers are hanging out there and if you’re looking to connect with some of them, you might be right.
  • Twitter is always a good source of information and so I’m also trying to expand my Twitter network of English-speaking and Vietnamese-speaking software developers. Java is also limited here, but I’m making progress. I started a list of the developers Vietnam I found on Twitter and hope it will grow over time. You’re invited to follow.
  • There has been a spin-off of the famous German JAX (originally for “Java, Apache, XML”, but by now covering the entire spectrum of enterprise software development) conferences, the “JAX Asia 2008″ in Singapore. Not exactly Vietnam, but close enough to make a trip for a conference that’s really worth it. Unfortunately it remained to be a one-time experiment that apparently just failed. I hope someone will try it again soon.
  • One more question I am asking myself is how popular Java really is in Vietnam. I am still trying to get reliable statistics and/or just a big number of personal opinions on that. Feel free to comment…

For the moment that’s about it, my current state of research. I found a lot more activity once I widened my search parameters (so to speak), e.g.  for “software development” (then including .NET development and others), “software” in general (including especially the whole field of ERP and CRM) or just plain “IT” (including Web 2.0, social media, digital marketing and such). More about that in one of the next posts. For now I just stick to what the title of this post promised, Java.

Deploy web apps in Tomcat with Ant and Cargo

In one of my current projects I am working on increasing the quality of a large software development team. Besides a long list of measures this also includes establishing an automated build and integration test cycle. For web applications this also means an automated deployment into a container of choice. The existing project environment gave me the following constraints:

  • Ant as build tool (I’d rather use Maven, but that’s how it is)
  • Tomcat 5.x as container (this rules out e.g. Jetty, which might be from some points of view easier to handle for automated tasks)
  • Should run on Windows and Linux (which kind of rules out running Tomcat executables)
  • Should be able to perform different builds and Tomcat deployments in parallel (which rules out having one pre-installed Tomcat instance on the server which is used for deployments and tests)

Furthermore everything should be triggered from Hudson, which isn’t that difficult anymore once it runs in Ant. After doing some research and in a first attempt trying to implement start and stop routines myself in Ant  I finally decided to drop that and give Cargo (http://cargo.codehaus.org) a shot. And frankly, I was exciting getting it to run. After all it was much less tedious than doing everything myself (well, that’s how it should be). I was a little disappointed about missing end-to-end examples which caused me to go the walk of trial and error until I have figured out what I wanted. That’s why I’d like to summarize what I did.

Cargo Ant Tasks

First of all download the two Cargo jar files and add the Ant tasks definition.

<taskdef resource="cargo.tasks">
	<classpath>
		<pathelement path="lib/cargo-ant-1.0.jar" />
		<pathelement path="lib/cargo-core-uberjar-1.0.jar" />
		<pathelement path="lib/commons-discovery-0.4.jar" />
		<pathelement path="lib/commons-logging-1.1.1.jar" />
		<pathelement path="lib/xercesImpl-2.4.0.jar" />
		<pathelement path="lib/dom4j-1.6.1.jar" />
		<pathelement path="lib/jaxen-1.1.2.jar" />
	</classpath>
</taskdef>

Remarks:

  1. I didn’t get Tomcat 5.5.29 to work with the most recent version 1.0.1. After a little while I tried 1.0 and it worked fine for me. So for now I’ll just stick to that. I might look into this again later.
  2. Besides the two cargo JAR files I also had to include some dependencies. As I didn’t want to put them into the Ant classpath or give them as additional dependencies on command line I decided to include them here.

Starting up Tomcat via Cargo in Ant

The main piece of Ant code is about executing the Cargo task which looks in my case like this:

<cargo containerId="tomcat5x" home="tomcat-template" output="build/tomcat-output.log" log="build/cargo.log" action="start" wait="false">
	<configuration type="standalone" home="build/tomcat-conf">
		<property name="cargo.servlet.port" value="${tomcat.port}" />
		<property name="cargo.logging" value="high" />
		<property name="cargo.jvmargs" value="-Xms1024m -Xmx1024m" />
		<deployable type="war" file="prepare/webapp1.war" />
		<deployable type="war" file="prepare/webapp2.war" />
	</configuration>
</cargo>

Remarks:

  1. I need to use Tomcat 5.5.29 so the Cargo containerId is set to tomcat5x. See also: List of available containers.
  2. The container “home” attribute is where Cargo is looking for a template Tomcat installation. In my case there is a full Tomcat as downloaded from the website but everything not necessary was removed (esp. all sorts of docs). The configuration attribute “home” is the directory where Cargo copies and configures the Tomcat instance that will be started up. In my case this is happening under a “build” directory. I also delete this directory at the beginning of every Ant build to have a 100% clean environment on every run.
  3. The action start tells Cargo to start up the container.
  4. The “wait” attribute is set to false, otherwise Cargo blocks Ant after the server is started. As I wanted to perform integration tests afterwards I needed a non-blocking startup. A nice debugging method is to set this attribute temporarily to true, run the Ant script, access your web app manually (e.g. with a browser) and then kill Tomcat again by cancelling your Ant execution with Ctrl+C.
  5. Since I am aiming at starting up multiple Tomcats at the same time I am assigning the “cargo.servlet.port” (which effectively sets the HTTP connector port in Tomcat’s servlet.xml) dynamically, i.e. with an Ant property.
  6. JVM args can also be passed to the container startup. For also: List of available properties.
  7. I have two wars that I want to deploy into this container so I also have two deployable tags. I put my wars into a prepare folder because I needed to manipulate them before running my tests. At this point Ant could pull the wars as well from build folders of other projects, from a repository or from whereever.

This launched my Tomcat successfully and without problems with Ant. Log output from Cargo as well as from Tomcat (the catalina.out) will be written into the specified logfiles.

Checking availability of your web app

At this point you can start to test your web application. You might want to add another little test before that in order to find out if everything went fine and your application is really actually available. One way of doing so works directly in Ant and looks like that:

<echo message="Ping web app..." />
<waitfor maxwait="10" maxwaitunit="second" timeoutproperty="webapp-not-available">
	<and>
		<socket server="localhost" port="${tomcat.port}" />
		<http url="http://localhost:${tomcat.port}/myWebApp/testPath123" errorsBeginAt="201" />
	</and>
</waitfor>
<fail if="webapp-not-available" message="Web app is not available." />
<echo message="Web app is available." />

Remarks:

  1. Note the Tomcat port, which is of course set to the same as above, as this will be set dynamically in my case.
  2. ErrorsBeginAt is set to 201, as this page should usually return a 200 OK and everything “above” should indicate an error to Ant.

That’s it

That was about everything it took to get Tomcat running under Windows and Linux and so far without problems. There aren’t any more problems also when the whole thing is started from Hudson, it just works well for me. Right now this configuration helps us to build up a pool of regression tests into our CI environment containing e.g. JMeter and Selenium tests.