Page 1 of 1

Filling out a template .. missing resource

PostPosted: Tue Sep 14, 2010 6:09 am
by dcole
I tried to get this working today with no success. I downloaded the subversion trunk tip, made it with maven, and used it in my project. It dies actually trying to load the ML document. Any of them I tried. Even trying to load the Invoice.docx, I get the following:

13.09.2010 14:40:35 *INFO * LoadFromZipNG:
For Relationship Id=rId2 Source is /word/document.xml, Target is ../customXml/item2.xml, type: http://schemas.openxmlformats.org/offic ... /customXml (LoadFromZipNG.java, line 336)
13.09.2010 14:40:35 *DEBUG* LoadFromZipNG: resolved uri: customXml/item2.xml (LoadFromZipNG.java, line 498)
13.09.2010 14:40:35 *INFO * ContentTypeManager: Looking at extension 'xml (ContentTypeManager.java, line 250)
13.09.2010 14:40:35 *INFO * ContentTypeManager: Found content type 'application/xml' for /customXml/item2.xml (ContentTypeManager.java, line 254)
13.09.2010 14:40:35 *ERROR* ResourceUtils: Couldn't get resource: org/docx4j/model/datastorage/bind.xslt (ResourceUtils.java, line 36)

Exception in thread "main" java.lang.ExceptionInInitializerError
at org.docx4j.openpackaging.contenttype.ContentTypeManager.newPartForContentType(ContentTypeManager.java:290)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.getPart(ContentTypeManager.java:256)
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:505)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:414)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:344)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:436)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:344)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:229)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:182)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:167)
at CustomXmlBinding.main(CustomXmlBinding.java:156)
Caused by: java.lang.NullPointerException
at org.docx4j.utils.ResourceUtils.getResource(ResourceUtils.java:41)
at org.docx4j.openpackaging.parts.CustomXmlDataStoragePart.<clinit>(CustomXmlDataStoragePart.java:135)
... 12 more


Any ideas? I compiled with Java 1.6_21
I got the same error more or less when I tried to use my template i have been working on with the nested stuff. Invoice.docx was just standard like you have it in the repository.

Re: Filling out a template .. missing resource

PostPosted: Tue Sep 14, 2010 9:40 am
by jason
dcole wrote:*ERROR* ResourceUtils: Couldn't get resource: org/docx4j/model/datastorage/bind.xslt


Looks like the maven build is omitting the XSLTs from the jar? .. nope, it is there when I build using mvn.

I think this is a problem in your local environment.

bind.xslt is one bit I didn't change. Ensure you have the current server copy.

Re: Filling out a template .. missing resource

PostPosted: Wed Sep 15, 2010 12:42 am
by dcole
I followed the build instructions directly from your site, so I am unsure what went wrong. Maven downloaded a lot of stuff, subversion didnt complain, and I got a .jar generated. I did edit the pom.xml as instructed as well.

Re: Filling out a template .. missing resource

PostPosted: Wed Sep 15, 2010 1:01 am
by jason
Did you verify your jar contains the xslt? (I expect it does)

You can try my jar: http://dev.plutext.org/docx4j/docx4j-ni ... 100914.jar

If that works, then we know it is something in the build process.

If it doesn't, then we know it is something to do with your run time environment.

Re: Filling out a template .. missing resource

PostPosted: Wed Sep 15, 2010 1:15 am
by dcole
I did use your nightly, and that does indeed get rid of the error. My built jar does not contain any .xslt files after inspecting it.
Do I need to download some other libs that maven didnt automatically get for me?

Using your nightly does indeed get rid of the bind.xslt error, but I do have a couple of other bugs but I will make a separate post

Re: Filling out a template .. missing resource

PostPosted: Wed Sep 15, 2010 9:47 am
by jason
maven should do everything for you.

i will try to replicate ..

- What version of mvn are you using?

- And is this Windows or Linux?

(Workarounds for now are to build with ant - just edit build.xml to point at your .m2 repository - or if you are using Eclipse, set up a project for docx4j)