1

docx4j(我托管)通常与 Sun/Oracle JAXB 实现一起使用;下面感兴趣的类是使用 XJC 生成的。

我想我会试试 EclipseLink MOXy,看看效果如何。

在上下文初始化时,我收到以下错误:

ERROR org.docx4j.jaxb.Context .<clinit> line 107 - Cannot initialize context
javax.xml.bind.JAXBException: 
Descriptor Exceptions: 
---------------------------------------------------------

Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Descriptor is missing for class [org.docx4j.vml.spreadsheetDrawing.STCF].
Mapping: org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[moveWithCellsOrSizeWithCellsOrAnchor]
Descriptor: XMLDescriptor(org.docx4j.vml.spreadsheetDrawing.CTClientData --> [DatabaseTable(ns15:ClientData)])

Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Descriptor is missing for class [org.docx4j.bibliography.STSourceType].
Mapping: org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[abbreviatedCaseNumberOrAlbumTitleOrAuthor]
Descriptor: XMLDescriptor(org.docx4j.bibliography.CTSourceType --> [])

Runtime Exceptions: 
---------------------------------------------------------

 - with linked exception:
[Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Descriptor is missing for class [org.docx4j.vml.spreadsheetDrawing.STCF].
Mapping: org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[moveWithCellsOrSizeWithCellsOrAnchor]
Descriptor: XMLDescriptor(org.docx4j.vml.spreadsheetDrawing.CTClientData --> [DatabaseTable(ns15:ClientData)])

Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Descriptor is missing for class [org.docx4j.bibliography.STSourceType].
Mapping: org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[abbreviatedCaseNumberOrAlbumTitleOrAuthor]
Descriptor: XMLDescriptor(org.docx4j.bibliography.CTSourceType --> [])

Runtime Exceptions: 
---------------------------------------------------------
]
    at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:698)
    at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:658)
    at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:143)
    at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:110)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
    at javax.xml.bind.ContextFinder.find(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at org.docx4j.jaxb.Context.<clinit>(Context.java:79)
    at org.docx4j.samples.OpenMainDocumentAndTraverse.<clinit>(OpenMainDocumentAndTraverse.java:52)
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Descriptor is missing for class [org.docx4j.vml.spreadsheetDrawing.STCF].
Mapping: org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[moveWithCellsOrSizeWithCellsOrAnchor]
Descriptor: XMLDescriptor(org.docx4j.vml.spreadsheetDrawing.CTClientData --> [DatabaseTable(ns15:ClientData)])

Exception [EclipseLink-110] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Descriptor is missing for class [org.docx4j.bibliography.STSourceType].
Mapping: org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping[abbreviatedCaseNumberOrAlbumTitleOrAuthor]
Descriptor: XMLDescriptor(org.docx4j.bibliography.CTSourceType --> [])

Runtime Exceptions: 
---------------------------------------------------------

    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:535)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:476)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:435)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:676)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:634)
    at org.eclipse.persistence.oxm.XMLContext$XMLContextState.<init>(XMLContext.java:830)
    at org.eclipse.persistence.oxm.XMLContext$XMLContextState.<init>(XMLContext.java:770)
    at org.eclipse.persistence.oxm.XMLContext.<init>(XMLContext.java:177)
    at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:726)
    at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:696)
    ... 13 more

第一对引用的类,我们有一个枚举STCFCTClientData

第二对引用的类,我们有另一个枚举STSourceTypeCTSourceType

我该如何解决这个问题?

4

1 回答 1

1

注意: 我是EclipseLink JAXB (MOXy)负责人,也是JAXB (JSR-222)专家组的成员。

我已经能够重现您所看到的问题。您看到的问题是由于以下错误:

更新

此问题现已在 EclipseLink 2.3.3 和 2.4.0 流中得到修复。您可以从以下位置下载包含修复程序的每晚构建:

于 2012-05-21T10:39:20.803 回答