Rainy days and Java always get me down

I've Moved My Blog

It's currently located at http://www.urlinone.com/blog

I should say "I'm moving my blog." It's a pretty painful process.

Pebble has blown up on me, and it's been many months since I've been able to blog reliably. I've lost posts. And now I've got to figure out how to migrate my past blog posts from Pebble to my new destination without all the URLs changing, lest external links become 404 Not Founds.

Why does everything in the 21st century have to be a three-day project???

These are the steps required to add a new library to your AppFuse project:

  1. Create a new directory under lib to hold your jars. For example, I created C:\projects\appfuseproj\lib\sonic-6.1.
  2. Copy your jar or jars into that directory. You can also create subdirectories under your new directory. For example, the lib\hibernate directory contains a lib subdirectory where jars that hibernate depends on are stored.
  3. Add a section in lib\lib.properties to hook your new jar(s) into the application, such as
    # Sonic - http://www.sonicsoftware.com
  4. Add your new jar(s) to your compile and test classpaths in properties.xml (in the root directory of your project), so that all your classes are resolvable at build time. There are a few ways you can do this, depending on how the new jars are organized in their directory. For example, I added several SonicMQ and Sonic ESB jars to the sonic-6.1 directory, so I added an ant fileset to the paths where they are needed:
    <!-- Service -->
    <path id="service.compile.classpath">
        <path refid="dao.compile.classpath"/>
        <pathelement location="${dist.dir}/${webapp.name}-dao.jar"/>
        <fileset dir="${javamail.dir}" includes="*.jar"/>
        <pathelement location="${commons-lang.jar}"/>
        <pathelement location="${commons-logging.jar}"/>
        <pathelement location="${commons-beanutils.jar}"/>
        <pathelement location="${commons-collections.jar}"/>
        <fileset dir="${sonic.dir}" includes="*.jar"/>
        <fileset dir="${spring.dir}" includes="*.jar"/>
        <fileset dir="${velocity.dir}" includes="*.jar"/>
    <path id="web.test.classpath">
        <path refid="web.compile.classpath"/>
        <pathelement location="${dumbster.jar}"/>
        <pathelement location="${junit.jar}"/>
        <pathelement location="${junitdoclet.jar}"/>
        <fileset dir="${webtest.dir}/lib" includes="*.jar"/>
        <pathelement location="${log4j.jar}"/>
        <fileset dir="${velocity.dir}" includes="*.jar"/>
        <fileset dir="${sonic.dir}" includes="*.jar"/>
        <!-- Needed for testing out-of-container -->
        <path refid="dao.compile.classpath"/>
    Notice that there are a couple of ways to reference your new jars, and you may use the .dir property or the .jar property. The pathelement and .jar property are for when you have a single jar to add to your classpath, but the fileset and .dir property work when you are adding a bunch of jars.

    Take special note of the hibernate classpath, because it can tell you how to construct a complex classpath that can be added to another classpath, for example:

    <!-- Hibernate -->
    <path id="hibernate.classpath">
        <pathelement location="${hibernate.jar}"/> 
        <fileset dir="${hibernate.dir}/lib" includes="*.jar"/>
        <pathelement location="${database.jar}"/> 
        <pathelement location="${commons-beanutils.jar}"/>
        <pathelement location="${commons-lang.jar}"/>
        <path location="${build.dir}/dao/classes"/>
    <!-- DAO -->
    <path id="dao.compile.classpath">
        <path refid="hibernate.classpath"/>
        <pathelement location="${commons-lang.jar}"/>
        <pathelement location="${commons-logging.jar}"/>
        <fileset dir="${spring.dir}" includes="*.jar"/>
    Here, the hibernate.classpath is constructed from pathelements, a fileset, and a path element. This multi-element path is then added to the dao.compile.classpath classpath using <path refid="hibernate.classpath"/>.
    (If you wish to do builds in Eclipse, you should add your new jars to your Eclipse build classpath, as well.)
  5. In the war target of build.xml (in the root directory of your project), you will need to add the jar(s) that you want deployed for runtime. I added the line
                <lib dir="${sonic.dir}" includes="*.jar"/>
    near the bottom of the list of lib elements within the war target. Remember that order in the classpath can sometimes be of significance, so place your new jars appropriately. If things start acting wiggy, that is something to look at.
    Also, take note of how the hibernate dependencies are included differently here from the way they were included in the classpath:
                <lib dir="${hibernate.dir}/lib">
                    <include name="odmg*.jar"/>
                    <include name="dom4j*.jar"/>
                    <include name="cglib*.jar"/>
                    <include name="ehcache*.jar"/>
                    <include name="oscache*.jar"/>
    With numerous or complex hierarchies of jars, you'll find using the hibernate structure as a guide can be helpful.

That should allow you to add any new custom or open source libraries to your AppFuse project. Have fun!