Page 1 of 1

Problems with WordProcessingMLPackage

PostPosted: Tue May 15, 2012 7:51 pm
by Binko
Hi All,

I am quite new to docx4j and I have a problem while loading a docm file.

It functions quite well, but when I close the rcp application where the code runs , I get the following message

Caused by: java.lang.ClassNotFoundException: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl

I debugged extensively to find where the problem is and found out that the DocumentBuilderFactoryImpl class loads successfully at the beginning.

Then I traced the problem to

WordprocessingMLPackage wordMLPackage = null;
try {
wordMLPackage = WordprocessingMLPackage.load(file);
} catch (Docx4JException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

When I comment out these lines, the app closes without exceptions.

So it seems that the exception comes from the loading. But I do now know where exactly.

Re: Problems with WordProcessingMLPackage

PostPosted: Tue May 15, 2012 11:21 pm
by jason
Hi; welcome aboard.

What version of docx4j are you using? Which Java implementation?

XmlPart contains:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                try {
                        // docx4j is not dependent on Xerces (other than here),
                        // but Websphere (presumably using IBM JDK) doesn't have
                        // Sun's Xerces implementation, so use real Xerces if it is
                        // on the class path
                        System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
                                "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
                        documentFactory = DocumentBuilderFactory.newInstance();
                } catch (javax.xml.parsers.FactoryConfigurationError fce) {
                        System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
                                "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
                        documentFactory = DocumentBuilderFactory.newInstance();
                }
 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


but chances are you are not using that class.

XmlUtils also sets some properties, but in svn trunk, it is commented out:

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

                        // Not needed
        //      System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
        //                              "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
 
Parsed in 0.013 seconds, using GeSHi 1.0.8.4

Re: Problems with WordProcessingMLPackage

PostPosted: Wed May 16, 2012 2:06 am
by Binko
I am using xercesImpl -2.9.1

There was something about com.sun before org for the class.

But the problem is that somehow the class cannot be found after I load a WordprocessingMLPackage.

I am working in eclipse rcp environment. The message is that the widget has been disposed too early and that the class cannot be found.

I am trying to get into the internals of docx4j LoadFromZipNG - it seems the problems comes in a recursion there when calling the parts.

But it is quite time expensive to get into that ;) especially with recúrsions.

Code: Select all

This is the excpetion trace:

parent:
template C:\prg\apache-tomcat-7.0.27\webapps\SComReport1\reports\SCOMreportTemplate11.docm
log4j:WARN No appenders could be found for logger (org.docx4j.utils.ResourceUtils).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
9 [main] INFO org.docx4j.utils.Log4jConfigurator  - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically.
14 [main] INFO org.docx4j.jaxb.Context  - JAXB: RI not present.  Trying Java 6 implementation.
15 [main] INFO org.docx4j.jaxb.Context  - JAXB: Using Java 6 implementation.
15 [main] INFO org.docx4j.jaxb.Context  - loading Context jc
3478 [main] INFO org.docx4j.jaxb.Context  - loaded com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl .. loading others ..
3680 [main] INFO org.docx4j.jaxb.Context  - .. others loaded ..
3883 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Detected WordProcessingML package
3889 [main] INFO org.docx4j.openpackaging.parts.Part  - /_rels/.rels
3890 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
3894 [main] INFO org.docx4j.openpackaging.parts.Part  - /docProps/app.xml
3894 [main] INFO org.docx4j.openpackaging.parts.DocPropsExtendedPart  - unmarshalling org.docx4j.openpackaging.parts.DocPropsExtendedPart
3897 [main] INFO org.docx4j.openpackaging.parts.Part  - /docProps/core.xml
3897 [main] INFO org.docx4j.openpackaging.parts.DocPropsCorePart  - unmarshalling org.docx4j.openpackaging.parts.DocPropsCorePart
3903 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/document.xml
3903 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart  - For MDP, unmarshall via binder
4051 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/_rels/document.xml.rels
4051 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
4053 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/endnotes.xml
4057 [main] WARN org.docx4j.XmlUtils  - Using default SAXParserFactory: null
4060 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/chart4.xml
4062 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler  - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/markup-compatibility/2006", local:"AlternateContent"). Expect
4062 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler  - continuing (with possible element/attribute loss)
4062 [main] INFO org.docx4j.openpackaging.parts.JaxbXmlPart  - encountered unexpected content; pre-processing
4259 [main] WARN org.docx4j.utils.XSLTUtils  - Found some mc:AlternateContent
4259 [main] WARN org.docx4j.utils.XSLTUtils  - Selecting c:style
4274 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/_rels/chart4.xml.rels
4274 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
4275 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'xlsx
4275 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' for /word/embeddings/Microsoft_Excel-Arbeitsblatt4.xlsx
4276 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/embeddings/Microsoft_Excel-Arbeitsblatt4.xlsx
4278 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4278 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/fontTable.xml
4283 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/styles.xml
4289 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/footnotes.xml
4290 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/chart3.xml
4292 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler  - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/markup-compatibility/2006", local:"AlternateContent"). Expect
4292 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler  - continuing (with possible element/attribute loss)
4292 [main] INFO org.docx4j.openpackaging.parts.JaxbXmlPart  - encountered unexpected content; pre-processing
4295 [main] WARN org.docx4j.utils.XSLTUtils  - Found some mc:AlternateContent
4295 [main] WARN org.docx4j.utils.XSLTUtils  - Selecting c:style
4303 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/_rels/chart3.xml.rels
4303 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
4304 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'xlsx
4304 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' for /word/embeddings/Microsoft_Excel-Arbeitsblatt3.xlsx
4305 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/embeddings/Microsoft_Excel-Arbeitsblatt3.xlsx
4305 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4305 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/footer2.xml
4305 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.FooterPart  - For MDP, unmarshall via binder
4309 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/numbering.xml
4323 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/header2.xml
4323 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.HeaderPart  - For MDP, unmarshall via binder
4328 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/_rels/header2.xml.rels
4328 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
4329 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'png
4329 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'image/png' for /word/media/image3.png
4384 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/media/image3.png
4385 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4385 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'png
4385 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'image/png' for /word/media/image2.png
4385 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/media/image2.png
4386 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4386 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'bin
4386 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'application/vnd.ms-office.vbaProject' for /word/vbaProject.bin
4386 [main] ERROR org.docx4j.openpackaging.contenttype.ContentTypeManager  - No subclass found for /word/vbaProject.bin; defaulting to binary
4386 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/vbaProject.bin
4387 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4387 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/_rels/vbaProject.bin.rels
4387 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
4388 [main] WARN org.docx4j.openpackaging.contenttype.ContentTypeManager  - DefaultPart used for part '/word/vbaData.xml' of content type 'application/vnd.ms-word.vbaData+xml'
4389 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/vbaData.xml
4390 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/webSettings.xml
4391 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/chart2.xml
4392 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler  - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/markup-compatibility/2006", local:"AlternateContent"). Expect
4392 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler  - continuing (with possible element/attribute loss)
4392 [main] INFO org.docx4j.openpackaging.parts.JaxbXmlPart  - encountered unexpected content; pre-processing
4395 [main] WARN org.docx4j.utils.XSLTUtils  - Found some mc:AlternateContent
4395 [main] WARN org.docx4j.utils.XSLTUtils  - Selecting c:style
4409 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/_rels/chart2.xml.rels
4409 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
4410 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'xlsx
4410 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' for /word/embeddings/Microsoft_Excel-Arbeitsblatt2.xlsx
4410 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/embeddings/Microsoft_Excel-Arbeitsblatt2.xlsx
4410 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4411 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/settings.xml
4413 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler  - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"compatSetting"). Expected
4413 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler  - continuing (with possible element/attribute loss)
4413 [main] INFO org.docx4j.openpackaging.parts.JaxbXmlPart  - encountered unexpected content; pre-processing
4422 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler  - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"compatSetting"). Expected
4422 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler  - continuing (with possible element/attribute loss)
4440 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/footer1.xml
4440 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.FooterPart  - For MDP, unmarshall via binder
4443 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/chart1.xml
4444 [main] WARN org.docx4j.jaxb.JaxbValidationEventHandler  - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/markup-compatibility/2006", local:"AlternateContent"). Expect
4444 [main] INFO org.docx4j.jaxb.JaxbValidationEventHandler  - continuing (with possible element/attribute loss)
4444 [main] INFO org.docx4j.openpackaging.parts.JaxbXmlPart  - encountered unexpected content; pre-processing
4446 [main] WARN org.docx4j.utils.XSLTUtils  - Found some mc:AlternateContent
4446 [main] WARN org.docx4j.utils.XSLTUtils  - Selecting c:style
4450 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/charts/_rels/chart1.xml.rels
4450 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
4451 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'xlsx
4451 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' for /word/embeddings/Microsoft_Excel-Arbeitsblatt1.xlsx
4451 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/embeddings/Microsoft_Excel-Arbeitsblatt1.xlsx
4451 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4451 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/theme/theme1.xml
4451 [main] INFO org.docx4j.openpackaging.parts.ThemePart  - unmarshalling org.docx4j.openpackaging.parts.ThemePart
4455 [main] WARN org.docx4j.openpackaging.contenttype.ContentTypeManager  - DefaultPart used for part '/word/stylesWithEffects.xml' of content type 'application/vnd.ms-word.stylesWithEffects+xml'
4455 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/stylesWithEffects.xml
4457 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Looking at extension 'png
4457 [main] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager  - Found content type 'image/png' for /word/media/image1.png
4457 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/media/image1.png
4458 [main] INFO org.docx4j.openpackaging.parts.Part  - .. closed.
4459 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/header1.xml
4459 [main] INFO org.docx4j.openpackaging.parts.WordprocessingML.HeaderPart  - For MDP, unmarshall via binder
4462 [main] INFO org.docx4j.openpackaging.parts.Part  - /word/_rels/header1.xml.rels
4462 [main] INFO org.docx4j.openpackaging.parts.relationships.RelationshipsPart  - unmarshalling org.docx4j.openpackaging.parts.relationships.RelationshipsPart
end
!SESSION 2012-05-15 17:04:31.130 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_03
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -application SComReport.application
Command-line arguments:  -application SComReport.application -data C:\source\ws_rcp/../runtime-SComReport.application -dev file:C:/source/ws_rcp/.metadata/.plugins/org.eclipse.pde.core/SComReport.application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

!ENTRY org.eclipse.ui.workbench 4 0 2012-05-15 17:04:46.240
!MESSAGE Widget disposed too early for part scomreport.View
!STACK 0
java.lang.RuntimeException: Widget disposed too early for part scomreport.View
   at org.eclipse.ui.internal.WorkbenchPartReference$1.widgetDisposed(WorkbenchPartReference.java:171)
   at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:123)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
   at org.eclipse.swt.widgets.Widget.release(Widget.java:808)
   at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:873)
   at org.eclipse.swt.widgets.Widget.release(Widget.java:811)
   at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:873)
   at org.eclipse.swt.widgets.Widget.release(Widget.java:811)
   at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:873)
   at org.eclipse.swt.widgets.Canvas.releaseChildren(Canvas.java:167)
   at org.eclipse.swt.widgets.Decorations.releaseChildren(Decorations.java:773)
   at org.eclipse.swt.widgets.Shell.releaseChildren(Shell.java:1290)
   at org.eclipse.swt.widgets.Widget.release(Widget.java:811)
   at org.eclipse.swt.widgets.Widget.dispose(Widget.java:446)
   at org.eclipse.swt.widgets.Decorations.dispose(Decorations.java:447)
   at org.eclipse.swt.widgets.Shell.dispose(Shell.java:715)
   at org.eclipse.jface.window.Window.close(Window.java:335)
   at org.eclipse.jface.window.ApplicationWindow.close(ApplicationWindow.java:307)
   at org.eclipse.ui.internal.WorkbenchWindow.hardClose(WorkbenchWindow.java:1768)
   at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:730)
   at org.eclipse.ui.internal.WorkbenchWindow.access$0(WorkbenchWindow.java:715)
   at org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:867)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
   at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:865)
   at org.eclipse.jface.window.WindowManager.close(WindowManager.java:109)
   at org.eclipse.ui.internal.Workbench$18.run(Workbench.java:1114)
   at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
   at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:1111)
   at org.eclipse.ui.internal.Workbench.access$15(Workbench.java:1040)
   at org.eclipse.ui.internal.Workbench$25.run(Workbench.java:1284)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
   at org.eclipse.ui.internal.Workbench.close(Workbench.java:1282)
   at org.eclipse.ui.internal.Workbench.close(Workbench.java:1254)
   at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:727)
   at org.eclipse.ui.internal.WorkbenchWindow.access$0(WorkbenchWindow.java:715)
   at org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:867)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
   at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:865)
   at org.eclipse.jface.window.Window.handleShellCloseEvent(Window.java:741)
   at org.eclipse.jface.window.Window$3.shellClosed(Window.java:687)
   at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:98)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
   at org.eclipse.swt.widgets.Decorations.closeWidget(Decorations.java:308)
   at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1677)
   at org.eclipse.swt.widgets.Control.windowProc(Control.java:4530)
   at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
   at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
   at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
   at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
   at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2526)
   at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
   at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
   at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
   at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
   at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
   at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
   at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2526)
   at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
   at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
   at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
   at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
   at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
   at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
   at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2531)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
   at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at scomreport.Application.start(Application.java:20)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

!ENTRY org.eclipse.ui 4 0 2012-05-15 17:04:46.277
!MESSAGE Unhandled event loop exception
!STACK 0
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
   at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:127)
   at org.eclipse.ui.XMLMemento.createWriteRoot(XMLMemento.java:157)
   at org.eclipse.ui.internal.PartStack.savePresentationState(PartStack.java:681)
   at org.eclipse.ui.internal.PartStack.dispose(PartStack.java:703)
   at org.eclipse.ui.internal.PartSashContainer.dispose(PartSashContainer.java:595)
   at org.eclipse.ui.internal.PerspectiveHelper.dispose(PerspectiveHelper.java:668)
   at org.eclipse.ui.internal.Perspective.dispose(Perspective.java:285)
   at org.eclipse.ui.internal.WorkbenchPage.dispose(WorkbenchPage.java:1868)
   at org.eclipse.ui.internal.WorkbenchWindow.closeAllPages(WorkbenchWindow.java:894)
   at org.eclipse.ui.internal.WorkbenchWindow.hardClose(WorkbenchWindow.java:1729)
   at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:730)
   at org.eclipse.ui.internal.WorkbenchWindow.access$0(WorkbenchWindow.java:715)
   at org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:867)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
   at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:865)
   at org.eclipse.jface.window.WindowManager.close(WindowManager.java:109)
   at org.eclipse.ui.internal.Workbench$18.run(Workbench.java:1114)
   at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
   at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:1111)
   at org.eclipse.ui.internal.Workbench.access$15(Workbench.java:1040)
   at org.eclipse.ui.internal.Workbench$25.run(Workbench.java:1284)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
   at org.eclipse.ui.internal.Workbench.close(Workbench.java:1282)
   at org.eclipse.ui.internal.Workbench.close(Workbench.java:1254)
   at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:727)
   at org.eclipse.ui.internal.WorkbenchWindow.access$0(WorkbenchWindow.java:715)
   at org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:867)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
   at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:865)
   at org.eclipse.jface.window.Window.handleShellCloseEvent(Window.java:741)
   at org.eclipse.jface.window.Window$3.shellClosed(Window.java:687)
   at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:98)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
   at org.eclipse.swt.widgets.Decorations.closeWidget(Decorations.java:308)
   at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1677)
   at org.eclipse.swt.widgets.Control.windowProc(Control.java:4530)
   at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
   at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
   at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
   at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
   at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2526)
   at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
   at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
   at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
   at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
   at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
   at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
   at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2526)
   at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
   at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
   at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
   at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
   at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2061)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
   at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
   at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2531)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
   at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at scomreport.Application.start(Application.java:20)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.ClassNotFoundException: org/apache/xerces/jaxp/DocumentBuilderFactoryImpl
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:264)
   at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:119)
   at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:144)
   at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:185)
   at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
   ... 82 more



Re: Problems with WordProcessingMLPackage

PostPosted: Wed May 16, 2012 3:51 am
by Binko
The problem comes when I call getRawPart in LoadFromZipNG with resolvedPartURi "word/stylesWithEffects.xml"

with all the others it works

if (resolvedPartUri.equals("docProps/app.xml")||
resolvedPartUri.equals("docProps/core.xml")||
resolvedPartUri.equals("word/document.xml")||
resolvedPartUri.equals("word/endnotes.xml")||
resolvedPartUri.equals("word/charts/chart4.xml")||
resolvedPartUri.equals("word/fontTable.xml")||
resolvedPartUri.equals("word/styles.xml")||
resolvedPartUri.equals("word/footnotes.xml")||
resolvedPartUri.equals("word/charts/chart3.xml")||
resolvedPartUri.equals("word/footer2.xml")||

resolvedPartUri.equals("word/numbering.xml")||
resolvedPartUri.equals("word/header2.xml")||
resolvedPartUri.equals("word/vbaProject.bin")
||
resolvedPartUri.equals("word/webSettings.xml")||
resolvedPartUri.equals("word/charts/chart2.xml")||
resolvedPartUri.equals("word/settings.xml")
||
resolvedPartUri.equals("word/footer1.xml")||
resolvedPartUri.equals("word/charts/chart1.xml")
||
resolvedPartUri.equals("word/theme/theme1.xml")
||
resolvedPartUri.equals("word/stylesWithEffects.xml")
){

When I comment out the last one , it works.
If I leave it uncommented then I get this problem.

Re: Problems with WordProcessingMLPackage

PostPosted: Wed May 16, 2012 4:44 am
by Binko
HI ,

as it seems the content type for stylesWithEffects is not in the Contenttypes.java class

So the ContenttypeManager goes to the default CreateDefaultXmlPartObject method.

I donÄt know wheter I may use

public final static String WORDPROCESSINGML_STYLES =
"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";

it is is for OpenOffice but may be it can work too. Not very familiar with these formats.

Re: Problems with WordProcessingMLPackage

PostPosted: Wed May 16, 2012 7:28 pm
by Binko
Hi again,

I used the method

Code: Select all
part = ctm.CreateStyleDefinitionsPartObject( partName);
part =

to create the part. And the exception has disapeeared.
Still have to see whether it has some problems later.

Re: Problems with WordProcessingMLPackage

PostPosted: Fri May 18, 2012 4:15 pm
by jason
stylesWithEffects.xml is a Microsoft extension to the document format, not part of the ECMA/ISO standard.

We don't do anything with it, it should just be preserved and saved again.

So representing it as XmlPart is the right thing to do (short of adding a proper part for it).

What happens if you use https://github.com/plutext/docx4j/commi ... 24518b5754

Now docx4j should fall back to whatever document builder you happen to have.

You said you have xercesImpl -2.9.1 on your class path. If that is correct (or you are using Sun/Oracle JDK 6 or later), this shouldn't be happening. So either you don't have Xerces or their JDK, or I have some typo setting "javax.xml.parsers.DocumentBuilderFactory" property. :?

Re: Problems with WordProcessingMLPackage

PostPosted: Fri May 18, 2012 7:08 pm
by Binko
Hallo jason,

the same problem comes with vbaData.xml

What I want to do is quite simple. I just want to copy the template and add a line saying where it is - path, so that the VBA code can read its path (as I open it in an RCP application and there the path is empty string ""). I store the server data in a xml file in the same directory as the output file. so it should be read.

But when I just load a WordprocessingMLPackage and save it with

Code: Select all
WordprocessingMLPackage p = WordPorcessingMLPackage(file);
p.save(outputFile);


The output file is 200 K less than the input file - so it does not copy everything. I am using a docm file with decorated (images) header, pics and some Excel charts.

Re: Problems with WordProcessingMLPackage

PostPosted: Fri May 18, 2012 9:04 pm
by jason
OK, with https://github.com/plutext/docx4j/commi ... 6d9b22207c the correct parts are used for VB.

Re the file size difference, please attach a docm which exhibits the change in size, or email it to me.

Re: Problems with WordProcessingMLPackage

PostPosted: Sat May 19, 2012 12:27 am
by Binko
I do not come well with what is the actual state of the docx4j project now.

In my project I am using docx4j - 2.7.1.jar

I have svn dwonloaded the docx4j project from http://www.docx4java.org/svn/docx4j/trunk to get in the source code

and now this githubproject.

So I have to get this github project.

Re: Problems with WordProcessingMLPackage

PostPosted: Sat May 19, 2012 8:28 am
by jason
Yes, hot off the press, we've moved from svn to GitHub.

See http://www.docx4java.org/blog/2012/05/d ... n-eclipse/ and the announcement in each of the forums (I guess it is easy to miss).

Re: Problems with WordProcessingMLPackage

PostPosted: Wed May 23, 2012 3:01 am
by Binko
well, it was my problem.

just not very familiar with the issue of class loaders in eclipse rcp.

When I call docx4j the class loader is changed to the DefaultClassLoader
Otherwise it is the ContextFinder

so i just had to save it and put it on the current thread after return from the call.