Page 1 of 1

Glassfish 3.1 JaxbValidationEventHandler errors

PostPosted: Tue Apr 12, 2011 12:45 am
by Franke
After installing windows 7 (and thus my development setup), docx4j doesn't seem to work anymore. When reading a docx (ones that worked earlier, or even extremly simple new documents containing just a few paragraphs), I get an exception as soon as it tries to parse the body tag:

Code: Select all
WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"body"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}body>,<{http://schemas.microsoft.com/office/2006/xmlPackage}background>
INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)


Which leads to a NULL body object. When continuing parsing, the same error occurs for style.xml with errors for every style-tag. Basicly, docx4j doesn't seem to recognize a single openXML tag anymore. I won't include an xml example since this occurs on every single document.

Complete log from trying to parse a document containing a single letter:

Code: Select all
11 Apr 2011 15:04:15,783 DEBUG ContentTypeManager : unmarshalling org.docx4j.openpackaging.contenttype.ContentTypeManager
11 Apr 2011 15:04:15,785 DEBUG ContentTypeManager : org.docx4j.openpackaging.contenttype.CTTypes unmarshalled
11 Apr 2011 15:04:15,785 DEBUG ContentTypeManager : Registered rels
11 Apr 2011 15:04:15,785 DEBUG ContentTypeManager : Registered xml
11 Apr 2011 15:04:15,785 INFO  ContentTypeManager : Registered /word/document.xml of type application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
11 Apr 2011 15:04:15,785 INFO  ContentTypeManager : Registered /word/styles.xml of type application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
11 Apr 2011 15:04:15,785 INFO  ContentTypeManager : Registered /docProps/app.xml of type application/vnd.openxmlformats-officedocument.extended-properties+xml
11 Apr 2011 15:04:15,785 INFO  ContentTypeManager : Registered /word/settings.xml of type application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
11 Apr 2011 15:04:15,786 INFO  ContentTypeManager : Registered /word/theme/theme1.xml of type application/vnd.openxmlformats-officedocument.theme+xml
11 Apr 2011 15:04:15,786 INFO  ContentTypeManager : Registered /word/fontTable.xml of type application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml
11 Apr 2011 15:04:15,786 INFO  ContentTypeManager : Registered /word/webSettings.xml of type application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml
11 Apr 2011 15:04:15,786 INFO  ContentTypeManager : Registered /docProps/core.xml of type application/vnd.openxmlformats-package.core-properties+xml
11 Apr 2011 15:04:15,786 DEBUG ContentTypeManager : Inspecting org.docx4j.openpackaging.contenttype.CTOverride@56fe026e
11 Apr 2011 15:04:15,786 DEBUG ContentTypeManager : Inspecting org.docx4j.openpackaging.contenttype.CTOverride@3e51b060
11 Apr 2011 15:04:15,786 DEBUG ContentTypeManager : Inspecting org.docx4j.openpackaging.contenttype.CTOverride@65128e96
11 Apr 2011 15:04:15,786 DEBUG ContentTypeManager : Matched!
11 Apr 2011 15:04:15,786 INFO  ContentTypeManager : Detected WordProcessingML package
11 Apr 2011 15:04:15,798 DEBUG PartName : Trying to create part name /
11 Apr 2011 15:04:15,800 DEBUG PartName : /_rels/.rels part name created.
11 Apr 2011 15:04:15,800 DEBUG PartName : /docProps/core.xml part name created.
11 Apr 2011 15:04:15,800 DEBUG PartName : / part name created.
11 Apr 2011 15:04:15,800 DEBUG PartName : / part name created.
11 Apr 2011 15:04:15,802 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml on part /


11 Apr 2011 15:04:15,807 DEBUG PartName : Trying to create part name /_rels/.rels
11 Apr 2011 15:04:15,807 DEBUG PartName : /_rels/.rels part name created.
11 Apr 2011 15:04:15,807 INFO  Part : Constructing /_rels/.rels
11 Apr 2011 15:04:15,807 DEBUG Base :
Set contentType application/vnd.openxmlformats-package.relationships+xml on part /_rels/.rels


11 Apr 2011 15:04:15,807 INFO  Part : unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart


11 Apr 2011 15:04:15,809 INFO  Part :

org.docx4j.openpackaging.parts.relationships.RelationshipsPart unmarshalled


11 Apr 2011 15:04:15,809 DEBUG RelationshipsPart : nextId reset to : 4
11 Apr 2011 15:04:15,809 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.relationships.RelationshipsPart
11 Apr 2011 15:04:15,809 INFO  LoadFromZipNG : Object created for: _rels/.rels
11 Apr 2011 15:04:15,809 INFO  LoadFromZipNG :
For Relationship Id=rId3 Source is /, Target is docProps/app.xml, type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties
11 Apr 2011 15:04:15,809 DEBUG LoadFromZipNG : resolved uri: docProps/app.xml
11 Apr 2011 15:04:15,809 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-officedocument.extended-properties+xml' for /docProps/app.xml
11 Apr 2011 15:04:15,810 DEBUG PartName : Trying to create part name /docProps/app.xml
11 Apr 2011 15:04:15,810 DEBUG PartName : /docProps/app.xml part name created.
11 Apr 2011 15:04:15,810 INFO  Part : Constructing /docProps/app.xml
11 Apr 2011 15:04:15,810 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.extended-properties+xml on part /docProps/app.xml


11 Apr 2011 15:04:15,810 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.extended-properties+xml on part /docProps/app.xml


11 Apr 2011 15:04:15,810 INFO  DocPropsExtendedPart : unmarshalling org.docx4j.openpackaging.parts.DocPropsExtendedPart


11 Apr 2011 15:04:15,811 INFO  DocPropsExtendedPart :

org.docx4j.openpackaging.parts.DocPropsExtendedPart unmarshalled


11 Apr 2011 15:04:15,811 INFO  Part : Loading part /docProps/app.xml
11 Apr 2011 15:04:15,811 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.DocPropsExtendedPart
11 Apr 2011 15:04:15,811 INFO  WordprocessingMLPackage : Set shortcut for docPropsExtendedPart
11 Apr 2011 15:04:15,811 INFO  LoadFromZipNG : Convenience method established from / to /docProps/app.xml
11 Apr 2011 15:04:15,811 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,811 INFO  LoadFromZipNG : No relationships docProps/_rels/app.xml.rels
11 Apr 2011 15:04:15,811 INFO  LoadFromZipNG :
For Relationship Id=rId2 Source is /, Target is docProps/core.xml, type: http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties
11 Apr 2011 15:04:15,811 DEBUG LoadFromZipNG : resolved uri: docProps/core.xml
11 Apr 2011 15:04:15,811 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-package.core-properties+xml' for /docProps/core.xml
11 Apr 2011 15:04:15,812 DEBUG PartName : Trying to create part name /docProps/core.xml
11 Apr 2011 15:04:15,812 DEBUG PartName : /docProps/core.xml part name created.
11 Apr 2011 15:04:15,812 INFO  Part : Constructing /docProps/core.xml
11 Apr 2011 15:04:15,812 DEBUG Base :
Set contentType application/vnd.openxmlformats-package.core-properties+xml on part /docProps/core.xml


11 Apr 2011 15:04:15,812 DEBUG Base :
Set contentType application/vnd.openxmlformats-package.core-properties+xml on part /docProps/core.xml


11 Apr 2011 15:04:15,812 INFO  DocPropsCorePart : unmarshalling org.docx4j.openpackaging.parts.DocPropsCorePart


11 Apr 2011 15:04:15,813 INFO  DocPropsCorePart :

org.docx4j.openpackaging.parts.DocPropsCorePart unmarshalled


11 Apr 2011 15:04:15,813 INFO  Part : Loading part /docProps/core.xml
11 Apr 2011 15:04:15,813 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.DocPropsCorePart
11 Apr 2011 15:04:15,813 INFO  WordprocessingMLPackage : Set shortcut for docPropsCorePart
11 Apr 2011 15:04:15,813 INFO  LoadFromZipNG : Convenience method established from / to /docProps/core.xml
11 Apr 2011 15:04:15,813 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,813 INFO  LoadFromZipNG : No relationships docProps/_rels/core.xml.rels
11 Apr 2011 15:04:15,813 INFO  LoadFromZipNG :
For Relationship Id=rId1 Source is /, Target is word/document.xml, type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument
11 Apr 2011 15:04:15,813 DEBUG LoadFromZipNG : resolved uri: word/document.xml
11 Apr 2011 15:04:15,813 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml' for /word/document.xml
11 Apr 2011 15:04:15,814 DEBUG PartName : Trying to create part name /word/document.xml
11 Apr 2011 15:04:15,814 DEBUG PartName : /word/document.xml part name created.
11 Apr 2011 15:04:15,814 INFO  Part : Constructing /word/document.xml
11 Apr 2011 15:04:15,814 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml on part /word/document.xml


11 Apr 2011 15:04:15,814 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml on part /word/document.xml


11 Apr 2011 15:04:15,815 INFO  MainDocumentPart : For MDP, unmarshall via binder
11 Apr 2011 15:04:15,817 WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"body"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}body>,<{http://schemas.microsoft.com/office/2006/xmlPackage}background>
11 Apr 2011 15:04:15,817 INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)
11 Apr 2011 15:04:15,818 INFO  Part : Loading part /word/document.xml
11 Apr 2011 15:04:15,818 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart
11 Apr 2011 15:04:15,818 INFO  WordprocessingMLPackage : Set shortcut for mainDoc
11 Apr 2011 15:04:15,818 INFO  LoadFromZipNG : Convenience method established from / to /word/document.xml
11 Apr 2011 15:04:15,818 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,818 INFO  LoadFromZipNG : Found relationships word/_rels/document.xml.rels
11 Apr 2011 15:04:15,818 INFO  LoadFromZipNG : Recursing ...
11 Apr 2011 15:04:15,818 DEBUG PartName : Trying to create part name /word/_rels/document.xml.rels
11 Apr 2011 15:04:15,818 DEBUG PartName : /word/_rels/document.xml.rels part name created.
11 Apr 2011 15:04:15,818 INFO  Part : Constructing /word/_rels/document.xml.rels
11 Apr 2011 15:04:15,818 DEBUG Base :
Set contentType application/vnd.openxmlformats-package.relationships+xml on part /word/_rels/document.xml.rels


11 Apr 2011 15:04:15,818 INFO  Part : unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart


11 Apr 2011 15:04:15,820 INFO  Part :

org.docx4j.openpackaging.parts.relationships.RelationshipsPart unmarshalled


11 Apr 2011 15:04:15,820 DEBUG RelationshipsPart : nextId reset to : 6
11 Apr 2011 15:04:15,820 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.relationships.RelationshipsPart
11 Apr 2011 15:04:15,820 INFO  LoadFromZipNG :
For Relationship Id=rId3 Source is /word/document.xml, Target is webSettings.xml, type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings
11 Apr 2011 15:04:15,820 DEBUG LoadFromZipNG : resolved uri: word/webSettings.xml
11 Apr 2011 15:04:15,820 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml' for /word/webSettings.xml
11 Apr 2011 15:04:15,820 DEBUG PartName : Trying to create part name /word/webSettings.xml
11 Apr 2011 15:04:15,820 DEBUG PartName : /word/webSettings.xml part name created.
11 Apr 2011 15:04:15,820 INFO  Part : Constructing /word/webSettings.xml
11 Apr 2011 15:04:15,820 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml on part /word/webSettings.xml


11 Apr 2011 15:04:15,820 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml on part /word/webSettings.xml


11 Apr 2011 15:04:15,820 DEBUG Part : unmarshalling org.docx4j.openpackaging.parts.WordprocessingML.WebSettingsPart
11 Apr 2011 15:04:15,829 DEBUG XmlUtils : Set TRANSFORMER_FACTORY_ORIGINAL to com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
11 Apr 2011 15:04:15,875 DEBUG XmlUtils : Unwrapped org.docx4j.wml.CTWebSettings
11 Apr 2011 15:04:15,875 DEBUG XmlUtils : name: {http://schemas.openxmlformats.org/wordprocessingml/2006/main}webSettings
11 Apr 2011 15:04:15,875 DEBUG Part : org.docx4j.openpackaging.parts.WordprocessingML.WebSettingsPart unmarshalled
11 Apr 2011 15:04:15,875 INFO  Part : Loading part /word/webSettings.xml
11 Apr 2011 15:04:15,875 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.WordprocessingML.WebSettingsPart
11 Apr 2011 15:04:15,875 INFO  LoadFromZipNG : Convenience method established from /word/document.xml to /word/webSettings.xml
11 Apr 2011 15:04:15,875 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,875 INFO  LoadFromZipNG : No relationships word/_rels/webSettings.xml.rels
11 Apr 2011 15:04:15,875 INFO  LoadFromZipNG :
For Relationship Id=rId2 Source is /word/document.xml, Target is settings.xml, type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings
11 Apr 2011 15:04:15,875 DEBUG LoadFromZipNG : resolved uri: word/settings.xml
11 Apr 2011 15:04:15,875 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml' for /word/settings.xml
11 Apr 2011 15:04:15,875 DEBUG PartName : Trying to create part name /word/settings.xml
11 Apr 2011 15:04:15,876 DEBUG PartName : /word/settings.xml part name created.
11 Apr 2011 15:04:15,876 INFO  Part : Constructing /word/settings.xml
11 Apr 2011 15:04:15,876 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml on part /word/settings.xml


11 Apr 2011 15:04:15,876 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml on part /word/settings.xml


11 Apr 2011 15:04:15,876 DEBUG Part : unmarshalling org.docx4j.openpackaging.parts.WordprocessingML.DocumentSettingsPart
11 Apr 2011 15:04:15,879 DEBUG XmlUtils : Unwrapped org.docx4j.wml.CTSettings
11 Apr 2011 15:04:15,880 DEBUG XmlUtils : name: {http://schemas.openxmlformats.org/wordprocessingml/2006/main}settings
11 Apr 2011 15:04:15,880 DEBUG Part : org.docx4j.openpackaging.parts.WordprocessingML.DocumentSettingsPart unmarshalled
11 Apr 2011 15:04:15,880 INFO  Part : Loading part /word/settings.xml
11 Apr 2011 15:04:15,880 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.WordprocessingML.DocumentSettingsPart
11 Apr 2011 15:04:15,880 INFO  LoadFromZipNG : Convenience method established from /word/document.xml to /word/settings.xml
11 Apr 2011 15:04:15,880 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,880 INFO  LoadFromZipNG : No relationships word/_rels/settings.xml.rels
11 Apr 2011 15:04:15,880 INFO  LoadFromZipNG :
For Relationship Id=rId1 Source is /word/document.xml, Target is styles.xml, type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles
11 Apr 2011 15:04:15,880 DEBUG LoadFromZipNG : resolved uri: word/styles.xml
11 Apr 2011 15:04:15,880 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml' for /word/styles.xml
11 Apr 2011 15:04:15,880 DEBUG PartName : Trying to create part name /word/styles.xml
11 Apr 2011 15:04:15,880 DEBUG PartName : /word/styles.xml part name created.
11 Apr 2011 15:04:15,880 INFO  Part : Constructing /word/styles.xml
11 Apr 2011 15:04:15,880 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml on part /word/styles.xml


11 Apr 2011 15:04:15,880 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml on part /word/styles.xml


11 Apr 2011 15:04:15,880 DEBUG Part : unmarshalling org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart
11 Apr 2011 15:04:15,882 WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"docDefaults"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}docDefaults>,<{http://schemas.microsoft.com/office/2006/xmlPackage}style>,<{http://schemas.microsoft.com/office/2006/xmlPackage}latentStyles>
11 Apr 2011 15:04:15,882 INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)
11 Apr 2011 15:04:15,882 WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"latentStyles"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}docDefaults>,<{http://schemas.microsoft.com/office/2006/xmlPackage}style>,<{http://schemas.microsoft.com/office/2006/xmlPackage}latentStyles>
11 Apr 2011 15:04:15,883 INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)
11 Apr 2011 15:04:15,884 WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"style"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}docDefaults>,<{http://schemas.microsoft.com/office/2006/xmlPackage}style>,<{http://schemas.microsoft.com/office/2006/xmlPackage}latentStyles>
11 Apr 2011 15:04:15,884 INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)
11 Apr 2011 15:04:15,884 WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"style"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}docDefaults>,<{http://schemas.microsoft.com/office/2006/xmlPackage}style>,<{http://schemas.microsoft.com/office/2006/xmlPackage}latentStyles>
11 Apr 2011 15:04:15,884 INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)
11 Apr 2011 15:04:15,884 WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"style"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}docDefaults>,<{http://schemas.microsoft.com/office/2006/xmlPackage}style>,<{http://schemas.microsoft.com/office/2006/xmlPackage}latentStyles>
11 Apr 2011 15:04:15,884 INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)
11 Apr 2011 15:04:15,884 WARN  JaxbValidationEventHandler : [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"style"). Expected elements are <{http://schemas.microsoft.com/office/2006/xmlPackage}docDefaults>,<{http://schemas.microsoft.com/office/2006/xmlPackage}style>,<{http://schemas.microsoft.com/office/2006/xmlPackage}latentStyles>
11 Apr 2011 15:04:15,884 INFO  JaxbValidationEventHandler : continuing (with possible element/attribute loss)
11 Apr 2011 15:04:15,885 DEBUG Part : org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart unmarshalled
11 Apr 2011 15:04:15,885 INFO  Part : Loading part /word/styles.xml
11 Apr 2011 15:04:15,885 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart
11 Apr 2011 15:04:15,885 INFO  LoadFromZipNG : Convenience method established from /word/document.xml to /word/styles.xml
11 Apr 2011 15:04:15,885 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,885 INFO  LoadFromZipNG : No relationships word/_rels/styles.xml.rels
11 Apr 2011 15:04:15,885 INFO  LoadFromZipNG :
For Relationship Id=rId5 Source is /word/document.xml, Target is theme/theme1.xml, type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme
11 Apr 2011 15:04:15,885 DEBUG LoadFromZipNG : resolved uri: word/theme/theme1.xml
11 Apr 2011 15:04:15,885 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-officedocument.theme+xml' for /word/theme/theme1.xml
11 Apr 2011 15:04:15,885 DEBUG PartName : Trying to create part name /word/theme/theme1.xml
11 Apr 2011 15:04:15,885 DEBUG PartName : /word/theme/theme1.xml part name created.
11 Apr 2011 15:04:15,885 INFO  Part : Constructing /word/theme/theme1.xml
11 Apr 2011 15:04:15,885 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.theme+xml on part /word/theme/theme1.xml


11 Apr 2011 15:04:15,886 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.theme+xml on part /word/theme/theme1.xml


11 Apr 2011 15:04:15,886 INFO  ThemePart : unmarshalling org.docx4j.openpackaging.parts.ThemePart


11 Apr 2011 15:04:15,896 INFO  ThemePart :

org.docx4j.openpackaging.parts.ThemePart unmarshalled


11 Apr 2011 15:04:15,896 INFO  Part : Loading part /word/theme/theme1.xml
11 Apr 2011 15:04:15,896 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.ThemePart
11 Apr 2011 15:04:15,896 INFO  LoadFromZipNG : Convenience method established from /word/document.xml to /word/theme/theme1.xml
11 Apr 2011 15:04:15,896 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,896 INFO  LoadFromZipNG : No relationships word/theme/_rels/theme1.xml.rels
11 Apr 2011 15:04:15,896 INFO  LoadFromZipNG :
For Relationship Id=rId4 Source is /word/document.xml, Target is fontTable.xml, type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable
11 Apr 2011 15:04:15,896 DEBUG LoadFromZipNG : resolved uri: word/fontTable.xml
11 Apr 2011 15:04:15,896 DEBUG ContentTypeManager : Found content type 'application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml' for /word/fontTable.xml
11 Apr 2011 15:04:15,896 DEBUG PartName : Trying to create part name /word/fontTable.xml
11 Apr 2011 15:04:15,897 DEBUG PartName : /word/fontTable.xml part name created.
11 Apr 2011 15:04:15,897 INFO  Part : Constructing /word/fontTable.xml
11 Apr 2011 15:04:15,897 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml on part /word/fontTable.xml


11 Apr 2011 15:04:15,897 DEBUG Base :
Set contentType application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml on part /word/fontTable.xml


11 Apr 2011 15:04:15,897 INFO  FontTablePart : unmarshalling org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart


11 Apr 2011 15:04:15,899 INFO  FontTablePart :

org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart unmarshalled


11 Apr 2011 15:04:15,899 INFO  Part : Loading part /word/fontTable.xml
11 Apr 2011 15:04:15,899 DEBUG Part : setPackage called for org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : Convenience method established from /word/document.xml to /word/fontTable.xml
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : .. added.
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : No relationships word/_rels/fontTable.xml.rels
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : docProps/app.xml  false
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : word/styles.xml  false
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : [Content_Types].xml  false
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : word/_rels/document.xml.rels  false
11 Apr 2011 15:04:15,899 INFO  LoadFromZipNG : docProps/core.xml  false
11 Apr 2011 15:04:15,900 INFO  LoadFromZipNG : word/fontTable.xml  false
11 Apr 2011 15:04:15,900 INFO  LoadFromZipNG : word/settings.xml  false
11 Apr 2011 15:04:15,900 INFO  LoadFromZipNG : word/document.xml  false
11 Apr 2011 15:04:15,900 INFO  LoadFromZipNG : _rels/.rels  false
11 Apr 2011 15:04:15,900 INFO  LoadFromZipNG : word/webSettings.xml  false
11 Apr 2011 15:04:15,900 INFO  LoadFromZipNG : word/theme/theme1.xml  false



using the latest Snapshot has no effect on this.

Any help would be greatly appreciated.

Re: JaxbValidationEventHandler error for all documents

PostPosted: Tue Apr 12, 2011 12:54 am
by jason
Looks like it is trying to use Context.jcXmlPackage, rather than Context.jc.

This would be appropriate if its a Flat OPC XML Package with extension .xml.

The loading logic does this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting

                if (docxFile.getName().endsWith(".xml")) {
                       
                        org.docx4j.convert.in.FlatOpcXmlImporter xmlPackage;
                        try {
                                Unmarshaller u = Context.jcXmlPackage.createUnmarshaller();
                                u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());

                                org.docx4j.xmlPackage.Package wmlPackageEl = (org.docx4j.xmlPackage.Package)((JAXBElement)u.unmarshal(
                                                new javax.xml.transform.stream.StreamSource(new FileInputStream(docxFile.getAbsolutePath())))).getValue();

                                xmlPackage = new org.docx4j.convert.in.FlatOpcXmlImporter( wmlPackageEl);
                        } catch (Exception e) {
                                log.error(e);
                                throw new Docx4JException("Couldn't load xml from " + docxFile.getAbsolutePath(), e);
                        }
                        return xmlPackage.get();
                }
               
// Otherwise, normal case

                LoadFromZipNG loader = new LoadFromZipNG();

 
Parsed in 0.016 seconds, using GeSHi 1.0.8.4


So if your filenames don't end with .xml, is there something else you might have changed?

hth .. Jason

Re: JaxbValidationEventHandler error for all documents

PostPosted: Tue Apr 12, 2011 1:00 am
by Franke
I'm using LoadFromZipNG directly to load the file from an inputstream, so I don't think it has access to the filename. This is the code that loads the document:

Code: Select all
InputStream template = this.getClass().getResourceAsStream("/test.docx");
Locale.setDefault(Locale.ENGLISH);
LoadFromZipNG loader = new LoadFromZipNG();
wordMLPackage = (WordprocessingMLPackage)loader.get(template);


Nothing has changed codewise since it did work, only the development environment.

EDIT: Tried loading with the convenience method in WordprocessingMLPackage.load with a file instead. Same error there.

Re: JaxbValidationEventHandler error for all documents

PostPosted: Tue Apr 12, 2011 1:43 am
by jason
Are you sure you have only one copy of docx4j on your path, and it is an unmodified distribution?

The relevant part of LoadFromZipFileNG is:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                                } else if (part instanceof org.docx4j.openpackaging.parts.JaxbXmlPart) {

                                        // MainDocument part, Styles part, Font part etc
                                       
                                        //((org.docx4j.openpackaging.parts.JaxbXmlPart)part).setJAXBContext(Context.jc);
                                        ((org.docx4j.openpackaging.parts.JaxbXmlPart)part).unmarshal( is );

 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


The context is commented out there, since it is set in the JaxbXmlPart constructor.

MDP overrides unmarshal:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
        @Override
    public org.docx4j.wml.Document unmarshal( java.io.InputStream is ) throws JAXBException {
 
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


but doesn't alter context.

In short, I have no idea how what you are seeing could be happening, if you haven't changed the context which is used for MainDocumentPart, or the definition of Context.jc.

Re: JaxbValidationEventHandler error for all documents

PostPosted: Tue Apr 12, 2011 1:59 am
by Franke
jason wrote:Are you sure you have only one copy of docx4j on your path, and it is an unmodified distribution?


It should be, I use maven with the following settings
Code: Select all
<repository>
      <id>docx4j</id>
      <name>docx4j Maven 2 repository</name>
      <url>http://dev.plutext.org/svn/docx4j/trunk/docx4j/m2</url>
</repository>
<dependency>
      <groupId>org.docx4j</groupId>
      <artifactId>docx4j</artifactId>
      <version>2.6.0</version>
</dependency>


jason wrote:In short, I have no idea how what you are seeing could be happening, if you haven't changed the context which is used for MainDocumentPart, or the definition of Context.jc.


I'll see if I can recreate the problem in a minimal setting (empty maven project that just loads a document)

Re: JaxbValidationEventHandler error for all documents

PostPosted: Tue Apr 12, 2011 7:08 pm
by Franke
Using a similar pom in a new project (normal client app though, instead of a java ee 6 project), it works as expected, though if some other library causes this error somehow, it might not get loaded since it's not used. By the way, when I said the code has not changed, I only meant the logic regarding docx4j, I have included a few more libraries and made some changes in other places since the last time docx4j worked successfully.

Is there any additional information I can provide to give you any hint of what can cause this?

EDIT: I downloaded the source code and debugged for a bit (though the lines were out of sync).

MainDocumentParts inherited jc.classes contains the following classes:
Code: Select all
org.docx4j.wml.ObjectFactory
org.docx4j.dml.ObjectFactory
org.docx4j.dml.chart.ObjectFactory
org.docx4j.dml.chartDrawing.ObjectFactory
org.docx4j.dml.compability.ObjectFactory
org.docx4j.dml.diagram.ObjectFactory
org.docx4j.dml.lockedCanvas.ObjectFactory
org.docx4j.dml.picture.ObjectFactory
org.docx4j.dml.wordprocessingDrawing.ObjectFactory
org.docx4j.dml.spreadsheetdrawing.ObjectFactory
org.docx4j.vml.ObjectFactory
org.docx4j.vml.officedrawing.ObjectFactory
org.opendope.xpaths.ObjectFactory
org.opendope.conditions.ObjectFactory
org.opendope.questions.ObjectFactory
org.opendope.components.ObjectFactory
org.docx4j.math.ObjectFactory


also containing 21 namespaceURIs and 1959 local names. Is this the wrong class? I'm not sure where to go from here.

Re: JaxbValidationEventHandler error for all documents

PostPosted: Tue Apr 12, 2011 11:30 pm
by jason
I think the following are the different logically possible causes of this:

1- changes to docx4j itself .. is it possible that there is a modified docx4j on your classpath that you aren't aware of?

2- something your client code is doing when interacting with docx4j

3- a broken JAXB implementation

4- a specially crafted input docx

If you are confident it is not 1 or 2, I'd be looking at 3. What version of Java are you using? Are you using a JAXB RI (is there one in endorsed dirs)?

cheers .. Jason

Re: JaxbValidationEventHandler error for all documents

PostPosted: Tue Apr 12, 2011 11:58 pm
by Franke
I have managed to pinpoint the problem to a few lines of code.
Code: Select all
documentPart = wordMLPackage.getMainDocumentPart();
bodyContent = documentPart.getJaxbElement().getBody().getEGBlockLevelElts();
List<SectionWrapper> sectionWrappers = wordMLPackage.getDocumentModel().getSections();
HeaderFooterPolicy hfp = sectionWrappers.get(0).getHeaderFooterPolicy();
headerPart = hfp.getDefaultHeader();
footerPart = hfp.getDefaultFooter();
Ftr f = footerPart.getJaxbElement();
System.out.println(f.toString());

If I don't use the footer for anything, it works. I assume the compiler optimizes it so most of the code above isn't run at all if it is not used for anything. If I put the same code in a new project that is not web application, it works. As you suggest, it must be that one of my libraries affects either Docx4j, or one of the libraries that Docx4j uses, perhaps loading different versions of them or similar.

I'm not very knowledgeable about alot of frameworks, but this is all the jars that is included in the final WAR. Maybe you can recognize something.

Code: Select all
2011-04-12  11:53            62 983 activation-1.1.jar
2011-04-12  11:53            33 218 avalon-framework-api-4.3.1.jar
2011-04-12  11:53            61 021 avalon-framework-impl-4.3.1.jar
2011-04-12  11:53            46 725 commons-codec-1.3.jar
2011-04-12  11:53            59 590 commons-fileupload-1.2.2.jar
2011-04-12  11:53            83 613 commons-io-1.3.1.jar
2011-04-12  11:53           261 809 commons-lang-2.4.jar
2011-04-12  11:53            60 686 commons-logging-1.1.1.jar
2011-04-12  11:53           376 015 commons-vfs-patched-1.9.1.jar
2011-04-12  11:53         4 301 043 docx4j-2.6.0.jar
2011-04-12  11:53         6 383 304 eclipselink-2.2.0.jar
2011-04-12  11:53         3 079 811 fop-1.0.jar
2011-04-12  11:53           226 653 hibernate-validator-4.0.2.GA.jar
2011-04-12  11:53           721 792 hwpf-3.4.0.jar
2011-04-12  11:53            89 967 jaxb-api-2.1.jar
2011-04-12  11:53           843 569 jaxb-impl-2.1.3.jar
2011-04-12  11:53             1 617 jaxb-NamespacePrefixMapper-interfaces-2.0.0.jar
2011-04-12  11:53           153 253 jdom-1.0.jar
2011-04-12  11:53            31 689 juel-api-2.2.2.jar
2011-04-12  11:53           106 906 juel-impl-2.2.2.jar
2011-04-12  11:53           481 535 log4j-1.2.16.jar
2011-04-12  11:53           119 180 mime-util-2.1.3.jar
2011-04-12  11:53         1 718 901 primefaces-2.2.1.jar
2011-04-12  11:53           278 281 serializer-2.7.1.jar
2011-04-12  11:53            22 338 slf4j-api-1.5.6.jar
2011-04-12  11:53             9 678 slf4j-log4j12-1.5.6.jar
2011-04-12  11:53            23 346 stax-api-1.0-2.jar
2011-04-12  11:53            47 433 validation-api-1.0.0.GA.jar
2011-04-12  11:53            39 477 wmf2svg-0.8.3.jar
2011-04-12  11:53         3 176 148 xalan-2.7.1.jar
2011-04-12  11:53           194 354 xml-apis-1.3.04.jar
2011-04-12  11:53           569 113 xmlgraphics-commons-1.4.jar


I'm using Java jdk1.6.0_24 64bit. I'm not sure if I use a JAXB RI, you can probably see that from the JAR-list.

Thank you for the effort until now, I hope we can solve this!

Re: JaxbValidationEventHandler error for all documents

PostPosted: Wed Apr 13, 2011 1:07 am
by jason
You list the JAXB reference implementation:

Code: Select all
2011-04-12  11:53            89 967 jaxb-api-2.1.jar
2011-04-12  11:53           843 569 jaxb-impl-2.1.3.jar


But these shouldn't be doing anything unless they are in an endorsed dir, since jdk1.6.0_24 would include JAXB, and that would take preference.

Please delete them for simplicity :-)

Also, you don't need:

Code: Select all
jaxb-NamespacePrefixMapper-interfaces-2.0.0.jar


That's only there to help you to build docx4j from source, where don't have both the Java 6 and JAXB RI on your class path.

Deleting those shouldn't make any difference, but maybe it will.

Re: JaxbValidationEventHandler error for all documents

PostPosted: Wed Apr 13, 2011 1:42 am
by Franke
Jaxb-api/impl is used by a validator jar from Hibernate, removing them has no effect. Removed jaxb-NamespacePrefixMapper-interfaces-2.0.0.jar aswell.

Nevermind my old ramblings of loader.get being affected by code infront of it, it has been the compiler fooling me, removing code without sideeffects.

What I have now is a completly stripped down, minimal Java EE project, it just has 1 empty page with one managed bean that runs exportDocx() on the following class:

Code: Select all
package com.xdin.competence.jpasession;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.Locale;
import org.apache.log4j.Logger;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.io.LoadFromZipNG;
import org.docx4j.openpackaging.io.SaveToZipFile;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.wml.Body;

public class CvExportBean {
    static final Logger logger = Logger.getLogger(CvExportBean.class.getName());
   
    public CvExportBean() {
    }

    public WordprocessingMLPackage generateDocument() throws Exception{
        WordprocessingMLPackage wordMLPackage = null;
        try {
            InputStream template = this.getClass().getResourceAsStream("/test.docx");
            Locale.setDefault(Locale.ENGLISH);
            // Load template file and fetch parts
            LoadFromZipNG loader = new LoadFromZipNG();
            wordMLPackage = (WordprocessingMLPackage)loader.get(template);
        }catch(Docx4JException e){
            e.printStackTrace();
        }
        return wordMLPackage;
    }

    public byte[] exportDocx(){
        try{
            SaveToZipFile saved = new SaveToZipFile(generateDocument());
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            saved.save(stream);
            return stream.toByteArray();
        } catch (Exception ex) {
            logger.fatal("Unable to create cv.", ex);
            return null;
        }
    }
}


And it doesn't work. The pom.xml is pretty much empty, only containing two dependencies: docx4j 2.6.0 and javaee-web-api 6.0. The docx file used is a newly created file using Office 2007 containing a single paragraph. I've cleared my maven repository. The code above is the single piece of logic in the whole application. I'm almost beginning to think that the problem lies in the application server itself since the code works in a Java SE application with the full classpath used in the Java EE variant.

Re: JaxbValidationEventHandler error for all documents

PostPosted: Wed Apr 13, 2011 9:44 am
by jason
Franke wrote:I'm almost beginning to think that the problem lies in the application server itself since the code works in a Java SE application with the full classpath used in the Java EE variant.


That's entirely possible.

http://dev.plutext.org/svn/docx4j/trunk ... ntext.java contains a fix we made at one point specifically for JBOSS, and how its class loaders work.

What app server are you using?

Could it have its own JAXB implementation? One thing you could try doing is to remove the definition of jcXmlPackage from Context.java, and see what happens. Maybe your app server will just pick another of the defined contexts!

Re: JaxbValidationEventHandler error for all documents

PostPosted: Wed Apr 13, 2011 7:05 pm
by Franke
jason wrote:
Franke wrote:I'm almost beginning to think that the problem lies in the application server itself since the code works in a Java SE application with the full classpath used in the Java EE variant.


That's entirely possible.

http://dev.plutext.org/svn/docx4j/trunk ... ntext.java contains a fix we made at one point specifically for JBOSS, and how its class loaders work.

What app server are you using?

Could it have its own JAXB implementation? One thing you could try doing is to remove the definition of jcXmlPackage from Context.java, and see what happens. Maybe your app server will just pick another of the defined contexts!


I'm using Glassfish (which indeed has its own JAXB implementation). Just rerolled back to version 3.01 instead of the new 3.1 and can confirm that this was the problem. 3.01 works perfectly. I updated to 3.1 some time before i switched development environment and apparently did not test docx4j before now. 16 horrid hours wasted on this, but at least the problem i known now.

Thanks for helping me out with this, I was beginning to give up hope. Would it be possible to release a Glassfish 3.1 compatible version of docx4j?

Re: Glassfish 3.1 JaxbValidationEventHandler errors

PostPosted: Wed Apr 13, 2011 11:08 pm
by jason
I'm glad you were able to narrow the problem down to Glassfish; thanks for persisting!

I've changed the title of this thread to reflect this.

Now....

Glassfish 3.1 uses Metro 2.1 [1]

Metro 2.1 uses JAXB RI 2.2.3-1 [2]

So I will install JAXB RI 2.2.3-1 and see whether I can reproduce. I expect I'll be able to - there is an earlier thread identifying 2.2.3 as a problem. [3]

I had a quick look at http://java.net/jira/browse/jaxb but couldn't see any relevant issues.

cheers .. Jason

[1] http://marek.potociar.net/2011/03/01/gl ... -1-is-out/
[2] http://metro.java.net/2.1/
[3] viewtopic.php?f=6&t=616