Tuesday, January 30, 2007

Ant problem: no class def SerializerTrace

I've started on a new project at work, where existing work has been done by colleagues doing Java development on Windows. Since I want to stick to my Linux environment, I'm trying to use the existing build scripts on Linux. The ant script works fine under Windows, but when I try to run the Ant xslt task on my FC5 machine (or RHEL 4, same thing happens), I get:

build.xml:74: The following error occurred while executing this line:
java.lang.NoClassDefFoundError: org/apache/xml/serializer/SerializerTrace

Now my Ant is installed via JPackage, and has all of its dependencies up-to-date. Double check, and, yup, xalan is installed and should provide all of the dependencies for the xslt Ant task. Google for answers, and it seems that there has been a packaging change in xalan 2.7, thereby confusing Ant (ants do have very small brains). This wiki page from the SipX project gives the necessary clue and recipe. Ant needs to be told to look for xalan-j2-serializer.jar, which can be achieved by dropping a file into /etc/ant.d. I'm not entirely clear what /etc/ant.d is doing, but this works for me:

root@rowan-8 ~
# cd /etc/ant.d

root@rowan-8 /etc/ant.d
# echo xalan-j2-serializer.jar > xslt

It doesn't matter what the file is called, it just needs to have the jar name in it. Presumably at some point the dependency issue will get sorted out cleanly. In the meantime, that's another minor but irritating roadblock out of the way.


Sanjay said...

Thanks, that helps!!

Anonymous said...


Anonymous said...

Likewise! This helped a bunch.

Anonymous said...

Thanks, that helped! Funny that this hasn't been fixed yet :)

Anonymous said...

Thanks! Still broken, but now good

Nic said...

Thanks from me too, this still seems to be broken

yntze said...

Thanks, this answer helps a lot!!