Getting java.lang.NoClassDefFoundError on ant -f integrator.xml

518 views
Skip to first unread message

Philip Dalrymple

unread,
Nov 20, 2015, 7:15:01 AM11/20/15
to DITA-OT Users
I am trying to customize the PDF output of a simple test map.

I am using dita-ot-2.2.0 on Fedora 23 all packages updated.

my java is:

echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.fc23.x86_64/jre


I can generate output using the command line for any of the formats that I have tested including pdf.

I used https://dita-generator-hrd.appspot.com/pdf-plugin/#p0 to generate a plugin for 2.x dita-ot and used
/bin/dita -install to install it without error.

when I try to install it again it says:
Error: Plug-in /home/pwd/src/foundation/docs/tools/dita-ot-2.2.0/plugins/com.mdtsoft.test-pdf already exists.

Which is fine.

but when I try to use the new plugin I get:

tools/dita-ot-2.2.0/bin/dita -f test-pdf -i t/data/top-simple-map.ditamap -o tmp/pdf-out
Error: The following error occurred while executing this line:
/home/pwd/src/foundation/docs/tools/dita-ot-2.2.0/plugins/org.dita.pdf2/build.xml:297: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.

I tried to create a build.xml file and use ant and got the same error for a builtin plugin. (pdf)

I then tried to run the integrator.xml and got the following:

[pwd@ws-pwd-2 dita-ot-2.2.0]$ bin/ant -f integrator.xml
Buildfile: /home/pwd/src/foundation/docs/tools/dita-ot-2.2.0/integrator.xml

strict:

integrate:

BUILD FAILED
/home/pwd/src/foundation/docs/tools/dita-ot-2.2.0/integrator.xml:66: The following error occurred while executing this line:
/home/pwd/src/foundation/docs/tools/dita-ot-2.2.0/integrator.xml:44: java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils
    at org.dita.dost.platform.Integrator.writeEnvShell(Integrator.java:394)
    at org.dita.dost.platform.Integrator.integrate(Integrator.java:320)
    at org.dita.dost.platform.Integrator.execute(Integrator.java:218)
    at org.dita.dost.platform.IntegratorTask.execute(IntegratorTask.java:40)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.Main.runBuild(Main.java:853)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.IOUtils
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1388)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1337)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1089)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 35 more

Looking at another question I tried

export ANT_OPTS=-Ddita.dir=/home/pwd/src/foundation/docs/tools/dita-ot-2.2.0

and then got just the same thing for the integrator run.

When I tried the DITA-OT1.8.5 I got much the same results

Kendall Shaw

unread,
Nov 20, 2015, 12:19:02 PM11/20/15
to dita-o...@googlegroups.com
Hi,

I don't have a complete answer. But, the ClassNotFound exception is saying that it can't find a class from commons-io.jar, which should be in the lib directory.

I would check if after uninstalling the plugin, running integrate produces the same error message.

In:

plugins/com.mdtsoft.test-pdf/plugin.xml

there should be an attribute specification, e.g. <plugin id="test-pdf">...</plugin>

Uninstall using

dita -uninstall test-pdf

where "test-pdf" is the id that you found above.

Then run integrate again and see if you get the same error. If you do, then your dita-ot is somehow messed up and it's hard to say what to try next.

If you have not installed other plugins or modified dita-ot, then you could extracting the dita-ot archive again and trying again.

Kendall
x    at org.dita.dost.platform.Integrator.writeEnvShell(Integrator.java:394)
--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philip Dalrymple

unread,
Nov 23, 2015, 6:21:17 AM11/23/15
to DITA-OT Users
OK I tried on a new Fedora 23 system (up to date)

I took the package dita-ot-2.2.0.tar.gz

and just unpacked it.

I CDed down into the sample directory and ran

 ../bin/dita -f pdf -i sequence.ditamap

that generated the correct (as far as I can see) pdf output in the "out" directory.

I then CDed down into the ant_sample directory and did a ..

../../bin/ant -f sample_all.xml

And got:



Buildfile: /home/pwd/tmp/dita-ot-2.2.0/samples/ant_sample/sample_all.xml

clean.samples.web:

samples.web:

init:

dita2xhtml.init:

check-arg:
    [mkdir] Created dir: /home/pwd/tmp/dita-ot-2.2.0/out/samples/web
    [mkdir] Created dir: /home/pwd/tmp/dita-ot-2.2.0/samples/ant_sample/temp/temp20151123061052247

log-arg:
     [echo] *****************************************************************
     [echo] * basedir = /home/pwd/tmp/dita-ot-2.2.0/samples/ant_sample
     [echo] * dita.dir = /home/pwd/tmp/dita-ot-2.2.0
     [echo] * transtype = xhtml
     [echo] * tempdir = /home/pwd/tmp/dita-ot-2.2.0/samples/ant_sample/temp/temp20151123061052247
     [echo] * outputdir = /home/pwd/tmp/dita-ot-2.2.0/out/samples/web
     [echo] * clean.temp = true
     [echo] * DITA-OT version = 2.1.2
     [echo] * XML parser = Xerces
     [echo] * XSLT processor = Xalan
     [echo] * collator = JDL
     [echo] *****************************************************************
     [echo] #Ant properties
     [echo] #Mon Nov 23 06:10:52 EST 2015
     [echo] args.grammar.cache=yes
     [echo] args.input=/home/pwd/tmp/dita-ot-2.2.0/samples/hierarchy.ditamap
     [echo] args.logdir=log
     [echo] args.xhtml.toc=toc
     [echo] args.xml.systemid.set=yes
     [echo] dita.dir=/home/pwd/tmp/dita-ot-2.2.0
     [echo] dita.plugin.com.sophos.tocjs.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/com.sophos.tocjs
     [echo] dita.plugin.org.dita.base.dir=/home/pwd/tmp/dita-ot-2.2.0
     [echo] dita.plugin.org.dita.docbook.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.docbook
     [echo] dita.plugin.org.dita.eclipsecontent.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.eclipsecontent
     [echo] dita.plugin.org.dita.eclipsehelp.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.eclipsehelp
     [echo] dita.plugin.org.dita.html5.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.html5
     [echo] dita.plugin.org.dita.htmlhelp.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.htmlhelp
     [echo] dita.plugin.org.dita.javahelp.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.javahelp
     [echo] dita.plugin.org.dita.odt.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.odt
     [echo] dita.plugin.org.dita.pdf2.axf.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.pdf2.axf
     [echo] dita.plugin.org.dita.pdf2.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.pdf2
     [echo] dita.plugin.org.dita.pdf2.fop.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.pdf2.fop
     [echo] dita.plugin.org.dita.pdf2.xep.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.pdf2.xep
     [echo] dita.plugin.org.dita.specialization.dita11.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.specialization.dita11
     [echo] dita.plugin.org.dita.specialization.eclipsemap.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.specialization.eclipsemap
     [echo] dita.plugin.org.dita.troff.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.troff
     [echo] dita.plugin.org.dita.wordrtf.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.wordrtf
     [echo] dita.plugin.org.dita.xhtml.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.xhtml
     [echo] dita.plugin.org.oasis-open.dita.v1_2.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.oasis-open.dita.v1_2
     [echo] dita.plugin.org.oasis-open.dita.v1_3.dir=/home/pwd/tmp/dita-ot-2.2.0/plugins/org.oasis-open.dita.v1_3
     [echo] dita.temp.dir=/home/pwd/tmp/dita-ot-2.2.0/samples/ant_sample/temp/temp20151123061052247
     [echo] *****************************************************************

build-init:

preprocess.init:
     [echo] *****************************************************************
     [echo] * input = /home/pwd/tmp/dita-ot-2.2.0/samples/hierarchy.ditamap
     [echo] *****************************************************************

gen-list:

BUILD FAILED
/home/pwd/tmp/dita-ot-2.2.0/samples/ant_sample/sample_xhtml.xml:11: The following error occurred while executing this line:
/home/pwd/tmp/dita-ot-2.2.0/build.xml:41: The following error occurred while executing this line:
/home/pwd/tmp/dita-ot-2.2.0/plugins/org.dita.base/build_preprocess.xml:42: java.lang.ClassNotFoundException: org.dita.dost.module.GenMapAndTopicListModule
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.tools.ant.IntrospectionHelper$6.set(IntrospectionHelper.java:1102)
    at org.apache.tools.ant.IntrospectionHelper$AttributeSetter.setObject(IntrospectionHelper.java:1510)
    at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:411)
    at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:527)
    at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:463)
    at org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:593)
    at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:359)
    at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:205)
    at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:164)
    at org.apache.tools.ant.Task.perform(Task.java:347)

    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.Main.runBuild(Main.java:853)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Total time: 1 second
--------------------------------------------------------------------------------------------------

I then went to the root of where I unpacked the tarball and did a :

bin/ant -f integrator.xml

And it failed like the ant build above.

Buildfile: /home/pwd/tmp/dita-ot-2.2.0/integrator.xml

strict:

integrate:

BUILD FAILED
/home/pwd/tmp/dita-ot-2.2.0/integrator.xml:66: The following error occurred while executing this line:
/home/pwd/tmp/dita-ot-2.2.0/integrator.xml:44: java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils
Total time: 0 seconds

Philip Dalrymple

unread,
Nov 23, 2015, 6:31:59 AM11/23/15
to DITA-OT Users

Just to check I did a git clone on the github source and followed the instructions to build the dist and then used the created tarball to repeat all of the tests above.

once again the "dita" command worked but all of the ant commands failed. (I did not install my plugin for any of these tests.

Philip Dalrymple

unread,
Nov 30, 2015, 8:05:59 AM11/30/15
to DITA-OT Users
OK I still have the problem with the stylesheet BUT I have found the problem with the No Class Defined error

I needed to have the apache common io jar file added to my CLASSPATH (for some reason it is not in by default so

CLASSPATH=/usr/share/java/commons-io.jar
 export CLASSPATH

made the bin/ant -f integrator.xml
run correctly.



Philip Dalrymple

unread,
Nov 30, 2015, 8:35:21 AM11/30/15
to DITA-OT Users
I am still getting a lot of problems with the toolkit, I can use unmodified plugins from the toolkit with the
dita command line but not the ant build nor any custom plugins.
Reply all
Reply to author
Forward
0 new messages