Page 1 of 1

javax.xml.bind.UnmarshalException: unexpected element

PostPosted: Wed May 13, 2009 9:20 pm
by sgr
Checked out revision 807 from svn, updated m2Repository/added -Djava.endorsed.dirs for jaxb-impl-2.1.3.jar, mvn install, ant dist

Getting the following exception in WordprocessingMLPackage.load on attached file - http://dev.plutext.org/trac/umbrella/ticket/7

i've tried it on revision 796(21 apr) and got the same exception. The same file+code however works with http://dev.plutext.org/docx4j/docx4j-SN ... 090422.jar Any advise? any additional settings required for my configuration?

java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)
log4j:WARN No appenders could be found for logger (org.docx4j.openpackaging.io.Load).
log4j:WARN Please initialize the log4j system properly.
javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/main", local:"theme"). Expected elements are <{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}anchor>,<{http://schemas.openxmlformats.org/drawingml/2006/main}blip>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}inline>,<{http://schemas.openxmlformats.org/drawingml/2006/picture}pic>,<{}theme>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeManager>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeOverride>
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:556)
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:194)
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:71)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:962)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:399)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:380)
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:101)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:195)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
at org.docx4j.openpackaging.parts.ThemePart.unmarshal(ThemePart.java:102)
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:520)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:430)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:362)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:446)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:362)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:228)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:179)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:163)
at testimage.main(testimage.java:17)
java.lang.IllegalArgumentException: obj parameter must not be null
at javax.xml.bind.helpers.AbstractMarshallerImpl.checkNotNull(AbstractMarshallerImpl.java:417)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:74)
at org.docx4j.openpackaging.parts.JaxbXmlPart.marshal(JaxbXmlPart.java:219)
at org.docx4j.openpackaging.parts.JaxbXmlPart.marshal(JaxbXmlPart.java:177)
at org.docx4j.openpackaging.io.SaveToZipFile.saveRawXmlPart(SaveToZipFile.java:172)
at org.docx4j.openpackaging.io.SaveToZipFile.saveRawXmlPart(SaveToZipFile.java:160)
at org.docx4j.openpackaging.io.SaveToZipFile.savePart(SaveToZipFile.java:329)
at org.docx4j.openpackaging.io.SaveToZipFile.addPartsFromRelationships(SaveToZipFile.java:297)
at org.docx4j.openpackaging.io.SaveToZipFile.savePart(SaveToZipFile.java:343)
at org.docx4j.openpackaging.io.SaveToZipFile.addPartsFromRelationships(SaveToZipFile.java:297)
at org.docx4j.openpackaging.io.SaveToZipFile.save(SaveToZipFile.java:130)
at org.docx4j.openpackaging.io.SaveToZipFile.save(SaveToZipFile.java:80)
at testimage.main(testimage.java:19)

Re: problem loading images

PostPosted: Sun May 17, 2009 12:51 am
by jason
Hi

This is curious.

From your stack trace:

javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/main", local:"theme"). Expected elements are ... <{}theme>


The problem seems to be that although JAXB received theme in the drawingml/2006/main namespace (as it ought to be), JAXB was expecting theme to be in the empty namespace.

I tried your test source with my working copy, and it worked fine - no errors, and i could see the image in the resulting docx.

Looking at the testimage_result.docx you supplied, there are two problems:
1. the theme part is blank
2. in the main document part, wp:inline content is largely missing

The stack trace you supplied seems to relate to reading the theme part.

Could you please turn on log4j debugging, and then attach the output? if you are using Eclipse, you can accomplish this by going into the run dialog, choose the class path tab, click on "User Entries" and then press the "advanced" button, and add the folder docx4j/src/main/resources.

Re: problem loading images

PostPosted: Mon May 18, 2009 10:16 pm
by sgr
attached

Re: problem loading images

PostPosted: Wed May 20, 2009 6:38 am
by jason
The logs confirm what we observed:

[00:40:53] [org.docx4j.openpackaging.parts.PartName] [DEBUG] - Trying to create part name /word/document.xml
[00:40:53] [org.docx4j.openpackaging.parts.PartName] [DEBUG] - /word/document.xml part name created.
[00:40:53] [org.docx4j.openpackaging.parts.Part] [INFO] - Constructing /word/document.xml
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [WARN] - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", local:"extent"). Expected elements are <{}docPr>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{}extent>,<{}cNvGraphicFramePr>,<{}effectExtent>
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [INFO] - continuing (with possible element/attribute loss)
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [WARN] - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", local:"effectExtent"). Expected elements are <{}docPr>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{}extent>,<{}cNvGraphicFramePr>,<{}effectExtent>
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [INFO] - continuing (with possible element/attribute loss)
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [WARN] - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", local:"docPr"). Expected elements are <{}docPr>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{}extent>,<{}cNvGraphicFramePr>,<{}effectExtent>
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [INFO] - continuing (with possible element/attribute loss)
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [WARN] - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", local:"cNvGraphicFramePr"). Expected elements are <{}docPr>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{}extent>,<{}cNvGraphicFramePr>,<{}effectExtent>
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [INFO] - continuing (with possible element/attribute loss)
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [WARN] - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/main", local:"graphicData"). Expected elements are <{}graphicData>
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [INFO] - continuing (with possible element/attribute loss)


and

unmarshalling org.docx4j.openpackaging.parts.ThemePart
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [WARN] - [(non)FATAL_ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/main", local:"theme"). Expected elements are <{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}anchor>,<{http://schemas.openxmlformats.org/drawingml/2006/main}blip>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}inline>,<{http://schemas.openxmlformats.org/drawingml/2006/picture}pic>,<{}theme>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeManager>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeOverride>
[00:40:53] [org.docx4j.jaxb.JaxbValidationEventHandler] [INFO] - continuing (with possible element/attribute loss)
[00:40:53] [org.docx4j.openpackaging.parts.relationships.RelationshipsPart] [INFO] - Loading part /word/theme/theme1.xml


But they don't provide any insight into why. I'm travelling at the moment. I might look into this some more when I get home.

Re: problem loading images

PostPosted: Wed Jun 03, 2009 10:48 am
by boz0413
Hi,

Is there any further development with this issue relating to theme parts? I am getting the exact same error message when marshalling/unmarshalling a document I am trying to replace mail merge tags in.

Thanks

Re: problem loading images

PostPosted: Wed Jun 03, 2009 11:27 am
by jason
I can't reproduce this error.

What version of JAXB are you using?

I am using 2.1.7; perhaps you could try that version and let me know whether this makes any difference?

Re: problem loading images

PostPosted: Wed Jun 03, 2009 12:32 pm
by boz0413
Hi Jason,

I updated the docx4j pom.xml file to pick up version 2.1.7 of JAXB:

Code: Select all

<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.1</version>
</dependency>
<dependency>
  <groupId>com.sun.xml.bind</groupId>
  <artifactId>jaxb-impl</artifactId>
  <version>2.1.7</version>
</dependency>



I then edited the docx4j build.xml file to use this jar:

Code: Select all

<path id="Maven Dependencies.libraryclasspath">
       ...
       <pathelement location="${m2Repository}/com/sun/xml/bind/jaxb-impl/2.1.7/jaxb-impl-2.1.7.jar"/>



I rebuilt docx4j.jar using ant and then executed my code which references the docx4j jar. I still get the following error message when the document is marshalled though:

Code: Select all

unmarshalling org.docx4j.openpackaging.parts.ThemePart


javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/main", local:"theme"). Expected elements are <{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}anchor>,<{http://schemas.openxmlformats.org/drawingml/2006/main}blip>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}inline>,<{http://schemas.openxmlformats.org/drawingml/2006/picture}pic>,<{}theme>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeManager>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeOverride>
   at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:609)
   at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:244)
   at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:239)
   at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
   at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1015)
   at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:452)
   at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:433)
   at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
   at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
   at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
   at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
   at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
   at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
   at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
   at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184)
   at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
   at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
   at org.docx4j.openpackaging.parts.ThemePart.unmarshal(ThemePart.java:104)
   at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:520)
   at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:430)
   at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:362)
   at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:446)
   at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:362)
   at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:228)
   at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:179)
   at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:163)
   at DocTest3.main(DocTest3.java:56)



I can run the unmarshallFromTemplateExample successfully but the difference here is my Word document contains mail merge fields as opposed to simple placeholders.

James

Re: problem loading images

PostPosted: Wed Jun 03, 2009 12:43 pm
by jason
Hi James,

Just to clarify, did you put JAXB 2.1.7 in your Java's endorsed dir?

.. Jason

Re: problem loading images

PostPosted: Wed Jun 03, 2009 1:13 pm
by boz0413
Jason,

I hadn't.

So I added the following to my build.xml (as illustrated on another forum discussion):

Code: Select all
    <property name="endorsedJarDirec" value="C:/eclipse/workspace/docx4j/endorsedJars" />
    ...
    <target depends="init" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac  bootclasspathref="jre.libs" includeJavaRuntime="yes"
           debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
            <src path="src/main/java"/>
            <classpath refid="docx4j.classpath"/>
           <compilerarg value="-Djava.endorsed.dirs=${endorsedJarDirec}"/>
        </javac>
    </target>


I copied jaxb-impl-2.1.7.jar into this endorsed directory and rebuilt the docx4j jar. Unfortunately, when I ran my code, I got the same exception.

I have attached the document (zipped) I am trying to marshal. Perhaps you would try it out for me on your environment?

Thanks,
James

James

Re: problem loading images

PostPosted: Wed Jun 03, 2009 2:30 pm
by jason
boz0413 wrote:I copied jaxb-impl-2.1.7.jar into this endorsed directory and rebuilt the docx4j jar. Unfortunately, when I ran my code, I got the same exception.


Unless I am misunderstanding you, you need to be using jaxb-impl-2.1.7.jar at the time you run your code, not at the time you build the docx4j jar.

If you are running your code from the command line, you could use something like java -Djava.endorsed.dirs=

When I run my code from Eclipse, I have that as a VM argument in the run dialog.

cheers

Jason

Re: problem loading images

PostPosted: Wed Jun 03, 2009 2:53 pm
by boz0413
Hi Jason,

Is the endorsed dir not required when building the docx4j jar then?

Anyway, I added -Djava.endorsed.dirs=C:\eclipse\workspace\docx4j\endorsedJars as a VM argument for my code (using the Run Configuration option in Eclipse) but this has not made a difference - I still get the same exception.

Thanks,
James

Re: problem loading images

PostPosted: Wed Jun 03, 2009 3:32 pm
by sgr
btw, when i run the test code below using docx4j.jar from download - it works fine. I experience this problem only with docx4j built from sources(with only jdk 1.6.0_12-b04, ant 1.7.1 and maven 2.0.10 installed - no eclipse/no other java libs).

sgr wrote:Checked out revision 807 from svn, updated m2Repository/added -Djava.endorsed.dirs for jaxb-impl-2.1.3.jar, mvn install, ant dist

Getting the following exception in WordprocessingMLPackage.load on attached file - http://dev.plutext.org/trac/umbrella/ticket/7

i've tried it on revision 796(21 apr) and got the same exception. The same file+code however works with http://dev.plutext.org/docx4j/docx4j-SN ... 090422.jar Any advise? any additional settings required for my configuration?

java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)
log4j:WARN No appenders could be found for logger (org.docx4j.openpackaging.io.Load).
log4j:WARN Please initialize the log4j system properly.
javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.openxmlformats.org/drawingml/2006/main", local:"theme"). Expected elements are <{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}anchor>,<{http://schemas.openxmlformats.org/drawingml/2006/main}blip>,<{http://schemas.openxmlformats.org/drawingml/2006/main}graphic>,<{http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing}inline>,<{http://schemas.openxmlformats.org/drawingml/2006/picture}pic>,<{}theme>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeManager>,<{http://schemas.openxmlformats.org/drawingml/2006/main}themeOverride>
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:556)
...
at testimage.main(testimage.java:19)

Re: problem loading images

PostPosted: Wed Jun 03, 2009 3:35 pm
by jason
James, Your document unmarshalls for me without error.

In this case I was using JDK 1.6.0_10 on Windows (although I usually use Linux, and without the error you experienced).

I see com.sun.org.apache.xerces in your stack trace.

Clutching at straws a bit here, but you could try using the real Xerces in your endorsed dirs, and System.setProperty("javax.xml.parsers.SAXParserFactory", ....

Re: problem loading images

PostPosted: Wed Jun 03, 2009 3:39 pm
by boz0413
sgr

That's interesting. Can I ask which version of the docx4j jar you downloaded which works for you?

Thanks
James

Re: problem loading images

PostPosted: Wed Jun 03, 2009 3:58 pm
by jason
sgr wrote:btw, when i run the test code below using docx4j.jar from download - it works fine. I experience this problem only with docx4j built from sources(with only jdk 1.6.0_12-b04, ant 1.7.1 and maven 2.0.10 installed - no eclipse/no other java libs).


I don't know what to make of that.

The docx4j jar I upload is built using only ant (Java 1.6.0_07 on Linux), and there is nothing in my src/java/main which isn't committed (and therefore available for your build).

It seems to suggest it is some latent issue which only surfaces after compiling with jdk 1.6.0_12-b04? James, what JDK are you using?

sgr, could you put your jar somewhere I can try it?

Re: problem loading images

PostPosted: Wed Jun 03, 2009 4:03 pm
by sgr
it works with docx4j-SNAPSHOT-20090422.jar and http://dev.plutext.org/docx4j/docx4j-ni ... 090528.jar

boz0413 wrote:That's interesting. Can I ask which version of the docx4j jar you downloaded which works for you?

Re: problem loading images

PostPosted: Wed Jun 03, 2009 5:19 pm
by boz0413
Jason,

I'm using JDK 1.6.0_11-b03

I downloaded the docx4j-nightly-20090528.jar (as suggested by sgr) and this works fine now.

Thanks
James

Re: javax.xml.bind.UnmarshalException: unexpected element

PostPosted: Thu Nov 19, 2009 8:06 am
by jason
You were getting JAXB "unexpected element" errors because of a dubious change introduced in ant 1.7.1 (see javac task doc, and ant bug 43114).

In Ant 1.7.1 the package-info.java will only be compiled if:
1. If a package-info.class file exists and is older than the package-info.java file.
2. If the directory for the package-info.class file does not exist.
3. If the directory for the package-info.class file exists, and has an older modification
time than the the package-info.java file. In this case <javac> will touch the corresponding
.class directory on successful compilation.


This meant the build would appear to succeed, but at runtime JAXB would produce mysterious errors (eg using wrong/incorrect/different unmarshaller); another symptom would be that things work in your IDE (eg Eclipse), but fail at the command line using jars built by ant.

Anyway, a work around for this was added to build.xml in http://dev.plutext.org/trac/docx4j/changeset/939

Since that change, one can properly build docx4all with ant 1.7.1.