I am newbie in docx4j. I am trying to execute ContentControlBindingExtensions sample. I am getting following error
log4j:WARN No appenders could be found for logger (org.docx4j.utils.ResourceUtils).
log4j:WARN Please initialize the log4j system properly.
0 [main] INFO org.docx4j.utils.Log4jConfigurator - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically.
203 [main] INFO org.docx4j.jaxb.Context - JAXB: RI not present. Trying Java 6 implementation.
203 [main] INFO org.docx4j.jaxb.Context - JAXB: Using Java 6 implementation.
203 [main] INFO org.docx4j.jaxb.Context - loading Context jc
3062 [main] INFO org.docx4j.jaxb.Context - loaded com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl .. loading others ..
3187 [main] INFO org.docx4j.jaxb.Context - .. others loaded ..
3312 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Detected WordProcessingML package
3312 [main] INFO org.docx4j.openpackaging.parts.Part - /_rels/.rels
3312 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
3312 [main] INFO org.docx4j.openpackaging.parts.Part - /docProps/app.xml
3312 [main] INFO org.docx4j.openpackaging.parts.DocPropsExtendedPart - unmarshalling org.docx4j.openpackaging.parts.DocPropsExtendedPart
3312 [main] INFO org.docx4j.openpackaging.parts.Part - /docProps/core.xml
3312 [main] INFO org.docx4j.openpackaging.parts.DocPropsCorePart - unmarshalling org.docx4j.openpackaging.parts.DocPropsCorePart
3328 [main] INFO org.docx4j.openpackaging.parts.Part - /word/document.xml
3328 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart - For MDP, unmarshall via binder
3343 [main] INFO org.docx4j.openpackaging.parts.Part - /word/_rels/document.xml.rels
3343 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
3343 [main] INFO org.docx4j.openpackaging.parts.Part - /word/theme/theme1.xml
3343 [main] INFO org.docx4j.openpackaging.parts.ThemePart - unmarshalling org.docx4j.openpackaging.parts.ThemePart
3343 [main] INFO org.docx4j.openpackaging.parts.Part - /word/settings.xml
3343 [main] INFO org.docx4j.openpackaging.parts.Part - /word/glossary/document.xml
3359 [main] INFO org.docx4j.openpackaging.parts.Part - /word/glossary/_rels/document.xml.rels
3359 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
3359 [main] INFO org.docx4j.openpackaging.parts.Part - /word/glossary/webSettings.xml
3359 [main] INFO org.docx4j.openpackaging.parts.Part - /word/glossary/settings.xml
3359 [main] INFO org.docx4j.openpackaging.parts.Part - /word/glossary/styles.xml
3359 [main] INFO org.docx4j.openpackaging.parts.Part - /word/glossary/fontTable.xml
3359 [main] INFO org.docx4j.openpackaging.parts.Part - /word/styles.xml
3375 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Looking at extension 'xml
3375 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Found content type 'application/xml' for /customXml/item1.xml
3375 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/item1.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/_rels/item1.xml.rels
3390 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/itemProps1.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /word/fontTable.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /word/comments.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /word/webSettings.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/xpaths.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/xpaths.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/_rels/xpaths.xml.rels
3390 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/xpathsProps.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/conditions.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/conditions.xml
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/_rels/conditions.xml.rels
3390 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
3390 [main] INFO org.docx4j.openpackaging.parts.Part - /customXml/conditionsProps.xml
3390 [main] INFO org.docx4j.openpackaging.io.Load - Identified/registered ds:itemId {8b049945-9dfe-4726-9de9-cf5691e53858}
D:/mypath/invoice
3406 [main] INFO org.docx4j.model.datastorage.OpenDoPEHandler - od:condition=c5
3406 [main] INFO org.docx4j.model.datastorage.OpenDoPEHandler - Processing Conditional: od:condition=c5
3406 [main] ERROR org.docx4j.model.datastorage.OpenDoPEHandler - Condition c5 references a missing xpath!
Exception in thread "main" java.lang.NullPointerException
at org.docx4j.model.datastorage.OpenDoPEHandler.getXPathFromCondition(OpenDoPEHandler.java:827)
at org.docx4j.model.datastorage.OpenDoPEHandler.processBindingRoleIfAny(OpenDoPEHandler.java:683)
at org.docx4j.model.datastorage.OpenDoPEHandler.access$100(OpenDoPEHandler.java:61)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.apply(OpenDoPEHandler.java:566)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.walkJAXBElements(OpenDoPEHandler.java:610)
at org.docx4j.TraversalUtil.<init>(TraversalUtil.java:150)
at org.docx4j.model.datastorage.OpenDoPEHandler.preprocess(OpenDoPEHandler.java:193)
at ccstry.ContentControlBindingExtensions.main(ContentControlBindingExtensions.java:70)
The code is failing at
- Code: Select all
odh.preprocess();
I have taken sample code from http://www.docx4java.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/samples/ContentControlBindingExtensions.java
invoice.docx from http://www.docx4java.org/trac/docx4j/browser/trunk/docx4j/sample-docs/databinding?rev=1267 and modified the path of this file in code as
- Code: Select all
String inputfilepath = "D:/mypath/invoice.docx";
- Code: Select all
String inputfilepath = System.getProperty("user.dir") + "/sample-docs/word/databinding/invoice.docx";
I have taken the jar files from http://www.docx4java.org/docx4j/docx4j-2.7.1/
Could please any one tell me where am I wrong or what I am missing?
Thanks