Page 1 of 1

ClassNotFoundException when running from grails

PostPosted: Thu Sep 16, 2010 4:37 am
by dcole
Jason, maybe you can help me here....

I am trying to run the docx4j project I have been working on (and got working successfully!) from a grails project. I put the docx4j jar in the lib folder of the grails project, and made a call to my DocxParser class from my controller.

I get a runtime exception at the line in the controller where I make a new instance of the DocxParser

The stacktrace and more details can be found here -

http://stackoverflow.com/questions/3719 ... me-package

essentially it seems like it can't find at least some of the stuff referenced in the docx4j jar, which I can see are there.

Any ideas?

Re: ClassNotFoundException when running from grails

PostPosted: Fri Sep 17, 2010 12:53 am
by dcole
Figured it out - it was the parent pointer jar missing from jaxb2-commons. For some reason the exception shows up as a missing RPr class or whatever else uses that from the wml directory

Re: ClassNotFoundException when running from grails

PostPosted: Fri Sep 17, 2010 11:05 pm
by jason
Glad to hear it :-)

Motivated by this and others who were missing the pp plugin, I've added its source code to the docx4j source tree http://dev.plutext.org/trac/docx4j/changeset/1230

So from that changeset onwards, the plugin jar is not required.

fyi, you can now run the samples listed in http://dev.plutext.org/trac/docx4j/changeset/1232 from a command line, with something like

Code: Select all
java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.OpenMainDocumentAndTraverse inputdocx


If there are any images in the document, you'd also need:

xmlgraphics-commons-1.4.jar

commons-logging-1.1.1.jar

(The HTML & PDF samples though both require more jars, including xalan)

I'll write all this up in Getting Started.