4

MOXyを使用すると、json出力でオブジェクトモデルの一部をフラット化できます

すなわち

<java-type name="Medium">
  <java-attributes>
    <xml-element java-attribute="trackList" xml-path="."/>
  </java-attributes>
</java-type>

しかし、静的クラスの子であるクラスでフォールドしたい場合は、次のようになります

<java-type name="Medium.TrackList">
  <java-attributes>
    <xml-element java-attribute="artistList" xml-path="."/>
  </java-attributes>
</java-type>

それは文句を言う

Exception Description: Could not load class [Medium.TrackList] declared in the external metadata file.  Please ensure that the class name is correct, and that the correct ClassLoader has been set.
    at org.eclipse.persistence.exceptions.JAXBException.couldNotLoadClassFromMetadata(JAXBException.java:376)
    at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.getXmlBindingsClasses(JAXBContext.java:979)
    at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:879)
    at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:157)

これを解決するにはどうすればよいですか?

4

1 に答える 1

3

EclipseLinkは、OXMで内部クラスを指定するときに、実際には「$」区切り文字を想定しています。私はあなたの問題を再現し、あなたのoxmファイルでこれを変更することによってそれを修正しました。

<java-type name="Medium$TrackList">
  <java-attributes>
    <xml-element java-attribute="artistList" xml-path="."/>
  </java-attributes>
</java-type>

お役に立てれば、

リック

于 2012-07-13T19:57:46.103 に答える