Make “Duke’s Bank” J2EE demo app work on JBoss 4.2.0.GA

I was trying to learn a bit about JBoss AS by following their Getting Started doc/tutorial.

When I got up to Chapter 4, which involves building and deploying the “Duke’s Bank” application from Sun’s J2EE tutorial to JBoss, I ran into errors when trying to compile.

~/j2eetutorial14/examples/bank$ ant -f jboss-build.xml compile | head
Buildfile: jboss-build.xml


    [javac] Compiling 61 source files to 
    [javac] /Users/marca/j2eetutorial14/examples
package javax.servlet.jsp does not exist
    [javac] import javax.servlet.jsp.JspTagException;

To fix this, I edited jboss-build.xml as follows:

--- jboss-build.xml.2007-06-21-102200   2007-06-21 10:18:55.000000000 -0700
+++ jboss-build.xml     2007-06-21 10:22:14.000000000 -0700
@@ -20,7 +20,7 @@
     <path id="build.classpath">
         <path refid="client.classpath"/>
        <fileset dir="${jboss.server}/lib/">
-            <include name="javax.servlet*.jar"/>
+            <include name="*.jar"/>

Later on in the tutorial, you are directed to run an Ant task to display some newly inserted rows in the hsql database.

~/j2eetutorial14/examples/bank$ ant -f jboss-build.xml db-list
Buildfile: jboss-build.xml

     [java] ScriptTool.init error: sql/hsql-list.sql (No such file or directory)
     [java] sql/hsql-list.sql 
(No such file or directory)

For some reason, I didn’t have the hsql-list.sql file. So I created one with SELECT * FROM account; as its contents.

Aside from these hiccups, the the tutorial worked fine.

Developing Java Applications on Mac OS X with Eclipse

I guess today I’ve just gotten on to a kick of learning new programming tools and environments.

I just did Apple’s Developing Java Applications on Mac OS X with Eclipse Tutorial.

This tutorial was pretty interesting to me because it revealed some more of the power of Eclipse. Here’s an outline of what is covered in the tutorial:

  • Creating a simple Java project in Eclipse from scratch
    • Creating a class in Eclipse
    • Using the Code assist feature
    • Using the refactoring features to move a class to a different package
  • Creating a Java Swing project in Eclipse by importing from an Xcode project
    • Importing a project from Xcode into Eclipse
    • Customizing Java compiler warnings
    • Customizing Java code formatting
    • Using the refactoring features extract a method from some lines of code
    • Using the folding features
  • Creating a Java SWT project
    • How to setup a SWT project and run it

Now I wonder if I can get Eclipse running on FreeBSD… Even better if I could manage to create a Native Eclipse built with gcj. It’s been done on Linux – I wonder if it could be done on FreeBSD…

This is why C++ templates are evil

stlfilt helps, but it doesn’t always save you from template hell.

comaofferimagegeneratorlib.cpp:149: cannot convert 
`it.Mdbm<_comaofferid ,ImageData *>::iterator::operator ->()->
Mdbm<_comaofferid ,ImageData *>::data_type>::second' 
from type `Mdbm<_comaofferid ,ImageData *>::data_type' 
to type `ImageData *'

It’s not impossible to interpret this, but it isn’t exactly a walk in the park either.

It’s times like these that make me appreciate the utter simplificity of Java and its container classes – by making every object inherit from a common base class (Object) and making containers that contain references to objects of that base class, you get a simple, elegant container mechanism. C++, not having a common base class, resorts to templates – a nifty but sometimes very irritating feature.